Subject: [xsl] naive identity transform question From: Jon Crump <jjcrump@xxxxxxxxxxxxxxxx> Date: Mon, 20 Nov 2006 14:20:13 -0800 (PST) |
I'm sure this is a very straightforward task, but I'm missing something fundamental about the identity transformation.
I want to copy an xml file exactly except if nodeX lacks a childY write element Y.
<xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
<xsl:template match="//snotes:SourceNote[not(snotes:sourceDate)]"> <xsl:element name="sourceDate"><xsl:text>0000-00-00</xsl:text></xsl:element> </xsl:template>
IE: copy all elements complete, except where //snotes:SourceNote has no snotes:sourceDate child. In that case, write a snotes:sourceDate element with the value 0000-00-00.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] oo2xhtml to RDF, Gannon Dick | Thread | Re: [xsl] naive identity transform , Jesper Tverskov |
Re: [xsl] Using copy-of to grab chi, David Carlisle | Date | Re: [xsl] naive identity transform , Jesper Tverskov |
Month |