XML-файл 1:
<?xml version="1.0"?>
<rentalProperties>
<property contact ="1">
<type>House </type>
<price>420</price>
<address>
<streetNo>1</streetNo>
<street>Wavell Street</street>
<suburb>Box Hill</suburb>
<state>VIC</state>
<zipcode>3128</zipcode>
</address>
<numberOfBedrooms>3</numberOfBedrooms>
<numberOfBathrooms>1</numberOfBathrooms>
<garage>1</garage>
</property>
XML-файл 2:
<?xml version="1.0"?>
<rentalProperties>
<property contact ="1">
<type>House </type>
<price>420</price>
<address>1 wavell street,Box Hill,VIC,Australia</address>
<numberOfBedrooms>3</numberOfBedrooms>
<numberOfBathrooms>1</numberOfBathrooms>
<garage>1</garage>
</property>
Как я должен конвертировать xml файл 1 в xml fle 2 с помощью xslt? я хочу представить адрес как одну строку и добавить новый атрибут [страна - Австралия] в конец строки. все остальное сделал я. Я борюсь с адресной строкой
XSLT-файл:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" type="text/css" href="style.css">
<xsl:template match="/">
<rentalProperties>
<property>
<xsl:attribute name="contact"><xsl:value-of select='@contact'/></xsl:attribute>
<type><xsl:value-of select="type"/></type>
<price><xsl:value-of select="price"/></price>
<numberOfBedrooms><xsl:value-of select="numberOfBedrooms"/></numberOfBedrooms>
<numberOfBathrooms><xsl:value-of select="numberOfBathrooms"/></numberOfBathrooms>
<garage><xsl:value-of select="garage"/></garage>
</property>
</rentalProperties>
</xsl:template>
</xsl:stylesheet>