xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] naive identity transform question


Subject: RE: [xsl] naive identity transform question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 20 Nov 2006 23:14:11 -0000

If it was working, I don't expect you would have posted this.

So it's presumably not working. What are the symptoms? It's much easier to
find a bug if you what the output is.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Jon Crump [mailto:jjcrump@xxxxxxxxxxxxxxxx] 
> Sent: 20 November 2006 22:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] naive identity transform question
> 
> 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.
> 
> The consensus on the identity transform suggested something like this:
> 
> xsl file identity.xsl
> 
>    <xsl:template match="node()|@*">
>        <xsl:copy>
>            <xsl:apply-templates select="@*|node()"/>
>        </xsl:copy>
>    </xsl:template>
> 
> xsl file intended transformation.xsl
> 
>    <xsl:import href="identity.xsl"/>
> 
>    <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.
> 
> Anyone willing to point out the obvious to the naive?


Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor