[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Insert character for missing nodes
Hi,
The other solutions look fine but if the elements in business can vary (e.g. applying to various sources), in xslt2 (for xslt1, replace "eq" with "=", "neq" with "!=" and "distinct-values" by the equivalent extension function for your processor), how about something like <xsl:variable name="src"> <business> <name>Hot Dog Stand</name> <address>123 Main St</address> <url>http://www.hotdogstand.com</url> </business> <business> <name>Joe's Pizza</name> <address>213 Pine St</address> </business> </xsl:variable> <xsl:variable name="fields" select="distinct-values($src//business/*/name()[not(. eq 'review')])"/> <xsl:template match="business"> <xsl:variable name="bus" select="."/> <xsl:for-each select="$fields"> <xsl:value-of select="$bus/*[name() eq current()]"/> <xsl:if test="position() neq last()"> <xsl:value-of select="'|'"/> </xsl:if> </xsl:for-each> <xsl:text> </xsl:text> </xsl:template> ac Hello,
|
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
|