I have the following xslt which copies selected element of xml but omits the root node how do i get the root node output as well?
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="yes" version="1.0" encoding="iso-8859-1" />
<xsl:template match="/">
<!--<xsl:copy-of select="itemList" />-->
<xsl:for-each select="itemList/saleItem">
<xsl:variable name="status">
<xsl:value-of select="status"/>
</xsl:variable>
<xsl:variable name="failed">
<xsl:text>failed</xsl:text>
</xsl:variable>
<xsl:variable name="sold">
<xsl:text>sold</xsl:text>
</xsl:variable>
<xsl:if test="$status = $failed or $status = $sold">
<xsl:copy-of select="self::node()"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I start with this xml
<?xml version="1.0"?>
<itemList>
<saleItem>
<sellerID>1234566</sellerID>
<itemName>dwe</itemName>
<category>Alcohol & Food</category>
<itemDescription>sdf</itemDescription>
<reservePrice>123.00</reservePrice>
<startingPrice>5.00</startingPrice>
<duration>100</duration>
<startTime>07:42:05</startTime>
<startDate>11-04-2012</startDate>
<itemNumber>1334122925</itemNumber>
<status>in-progress</status>
<buyerID>1244124</buyerID>
<currentBid>12441241.00</currentBid>
</saleItem>
<saleItem>
<sellerID>1234566</sellerID>
<itemName>dwe</itemName>
<category>Alcohol & Food</category>
<itemDescription>sdf</itemDescription>
<reservePrice>123.00</reservePrice>
<startingPrice>5.00</startingPrice>
<duration>100</duration>
<startTime>07:42:05</startTime>
<startDate>11-04-2012</startDate>
<itemNumber>1334122925</itemNumber>
<status>sold</status>
<buyerID>1244124</buyerID>
<currentBid>12441241.00</currentBid>
</saleItem>
<saleItem>
<sellerID>123456</sellerID>
<itemName>sdfsdf</itemName>
<category>Alcohol & Food</category>
<itemDescription>sdfsdf</itemDescription>
<reservePrice>123456.00</reservePrice>
<startingPrice>1.00</startingPrice>
<duration>1</duration>
<startTime>10:09:19</startTime>
<startDate>10-04-2012</startDate>
<itemNumber>1334218159</itemNumber>
<status>failed</status>
<buyerID>null</buyerID>
<currentBid>1.00</currentBid>
</saleItem>
</itemList>
and end up with everything right but no root node!!
<?xml version="1.0" encoding="iso-8859-1"?>
<saleItem>
<sellerID>1234566</sellerID>
<itemName>dwe</itemName>
<category>Alcohol & Food</category>
<itemDescription>sdf</itemDescription>
<reservePrice>123.00</reservePrice>
<startingPrice>5.00</startingPrice>
<duration>100</duration>
<startTime>07:42:05</startTime>
<startDate>11-04-2012</startDate>
<itemNumber>1334122925</itemNumber>
<status>sold</status>
<buyerID>1244124</buyerID>
<currentBid>12441241.00</currentBid>
</saleItem>
<saleItem>
<sellerID>123456</sellerID>
<itemName>sdfsdf</itemName>
<category>Alcohol & Food</category>
<itemDescription>sdfsdf</itemDescription>
<reservePrice>123456.00</reservePrice>
<startingPrice>1.00</startingPrice>
<duration>1</duration>
<startTime>10:09:19</startTime>
<startDate>10-04-2012</startDate>
<itemNumber>1334218159</itemNumber>
<status>failed</status>
<buyerID>null</buyerID>
<currentBid>1.00</currentBid>
</saleItem>
Please help this == moron?