I'm trying to produce an xml file that is pretty much identical to the initial one, but I need my xsl sheet to transform it to only include those with a < type > of either 'apartment' or 'unit' and have a value of more than 1 in < numberofBedrooms > I'm completely lost, any help would be greatly appreciated!
my initial xml sheet is as following:
<rentalProperties>
<property available="yes" contact="0423020892">
<type>house</type>
<price>800</price>
<address>
<streetNo>116</streetNo>
<street>Warrigal Road</street>
<suburb>Camberwell</suburb>
<state>VIC</state>
<zipcode>3124</zipcode>
</address>
<numberOfBedrooms>4</numberOfBedrooms>
<description>Ideal for the familly is this charming Californian Bungalow. Comprising a spacious living area, formal dining room plus a huge family/meals area, bright modern well appointed kitchen with dishwasher, gas cooktop and electric oven and heaps of bench space, Four double bedrooms, two in a wing of their own, are served by a stylishly renovated central bathroom and second sky-lit bathroom to the rear.</description>
</property>
</rentalproperties>
My xsl:
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:element name="RentalProperties">
<xsl:apply-templates select="rentalProperties/property"/>
</xsl:element>
</xsl:template>
<xsl:template match="rentalProperties/property/type">
<xsl:element name="type" >
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="rentalProperties/property/price">
<xsl:element name="price" >
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="rentalProperties/property/address">
<xsl:element name="address" >
<xsl:value-of select="streetNo"/><xsl:value-of select="street"/><xsl:value-of select="suburb"/><xsl:value-of select="state"/><xsl:value-of select="zipcode"/>
</xsl:element>
</xsl:template>
<xsl:template match="rentalProperties/property/numberOfBedrooms">
<xsl:element name="numberOfBedrooms" >
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="rentalProperties/property/description">
<xsl:element name="description" >
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
The output would be something like:
<RentalProperties>
<property>
<type>apartment</type>
<price>400</price>
<address>4/3,Acheron Avenue,Camberwell,VIC,3124, Australia</address>
<numberOfBedrooms>2</numberOfBedrooms>
<description>This two bedroom apartment is located in quiet tree lined street, just minutes from tram and easy walk to Camberwell Junction and train. Positioned on the 1st floor with sunny north facing lounge and balcony.
</description>
</property>
</RentalProperties>
Thanks