|
Subject: [xsl] Tag's depending on cousin element From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx> Date: Thu, 10 Jul 2003 08:00:47 +0000 |
<lv> <state><secret/><important/></state> <declaration> Some text here </declaration> </lv>
Now, I wan't the output to be something like <lv> <secret><important> Some text here </important></secret> </lv>
... <xsl:template match="lv/declaration"> <xsl:call-template name="state"/> </xsl:template>
<xsl:template name="state">
<xsl:choose>
<xsl:when test="../state/secret">
<xsl:choose>
<xsl:when test="../state/important">
<secret><important><xsl:value-of select="."/></important></secret>
</xsl:when>
<xsl:otherwise>
<secret><xsl:value-of select="."/></secret>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="../state/important">
<important><xsl:value-of select="."/></important>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
...Is there some smarter way of doing this? A more elaborate answer than "yes" or "no" will be appreciated :)
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] output html source, Jim Fuller | Thread | Re: [xsl] Tag's depending on cousin, David Carlisle |
| [xsl] output html source, Keith Anderson | Date | RE: [xsl] output html source, Jim Fuller |
| Month |