[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

naive identity transform question

Subject: naive identity transform question
From: Jon Crump <jjcrump@xxxxxxxxxxxxxxxx>
Date: Mon, 20 Nov 2006 14:20:13 -0800 (PST)
 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.