[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Jesse Gillies wrote:
With XSLT 2.0 you could use e.g.
<xsl:template match="business">
<xsl:value-of select="(name, address, if (url) then url else '')" separator="|"/>
</xsl:template>
if the url element is the only one that could be missing.
With XSLT 1.0 you might be better off to write one stylesheet that adds empty elements as needed, then run your current stylesheet.
--
Re: [xsl] Insert character for missing nodes
Subject: Re: [xsl] Insert character for missing nodes From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Thu, 30 Oct 2008 16:29:56 +0100 |
Jesse Gillies wrote:
<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>
Because Joe's Pizza is missing the url node, I don't get a pipe, which throws off my columns. Is there a way to test for all possible nodes, and where any are missing, to insert a character?
With XSLT 2.0 you could use e.g.
<xsl:template match="business">
<xsl:value-of select="(name, address, if (url) then url else '')" separator="|"/>
</xsl:template>
if the url element is the only one that could be missing.
With XSLT 1.0 you might be better off to write one stylesheet that adds empty elements as needed, then run your current stylesheet.
--
Martin Honnen http://JavaScript.FAQTs.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Insert character for missing , Jesse Gillies | Thread | Re: [xsl] Insert character for miss, Wendell Piez |
Re: [xsl] Extensions in AltovaXML, Florent Georges | Date | Re: [xsl] Insert character for miss, Michael Ludwig |
Month |
Keywords