[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Storing output tree in a variable and stripping
Hello,
I just investigated the possibility to store the output tree in a variable ... <xsl:variable name="outputRaw"> <xsl:apply-templates match="abc"/> <xsl:apply-templates match="def"/> ... </xsl:variable> ... in order to strip away all empty elements without having (a) to create a separate stylesheet which would do this job or (b) complex if-then structures in order to prevent the creation of an empty element beforehand. Below is the xslt-code which is responsible for selecting and displaying only non-empty nodes which had been created beforehand by the given templates and stored in the $outputRaw variable. <xsl:for-each select="$outputRaw/*[text() | *]"> <xsl:copy-of select="."/> </xsl:for-each> Although this solution seems to me pretty elegant in comparison to (a) a separate stylesheet or (b) if-then structures which would only bloat the xslt-code , I'm not quite sure if this solution is a good idea regarding the performance of the stylesheet. I would be very thankful for any clues and advice. Regards, Matthias
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|