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

problems with xsl:copy instruction

Subject: problems with xsl:copy instruction
From: Rahil <qamar_rahil@xxxxxxxxxxx>
Date: Thu, 26 May 2005 15:28:19 +0100
copy of xsl
Hi

My understanding of how the <xsl:copy> and <xsl:copy-of> commands is weak and so am having trouble figuring out the exact problem.

I want to copy all the contents of an output(held in memory), say interim.xml, as is except when a condition is encountered in which case the <xsl:call-template> is invoked.

My code so far is such :
---------------------------------------------------------------

<xsl:template match="/">
<TopConcept name="{TopConcept/@name}">
<xsl:apply-templates select="TopConcept"/>
</TopConcept>
</xsl:template>
<xsl:template match="TopConcept">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:for-each select="/*/*/O/Class[text()=$notPresent]">
<xsl:apply-templates select="/*/*/O/Class[text()=$notPresent]"/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="@*"/>
</xsl:copy>
</xsl:template>


<xsl:template match="Class"/>

-------------------------------------------

The output Im getting at the moment is

<TopConcept name="Headache">
  <TopConcept xmlns:saxon="http://saxon.sf.net/" name="Heading">
   <!-- followed by all the output from the template 'Class'-->
</TopConcept>
</TopConcept>

------------------------------------

I dont know why the copy statement is writing out the <TopConcept> again. Also my <xsl:apply-templates select="@*"/> isnt recursing.

Could someone please let me know where the problem lies. I need to get the final output properly formatted and ready for a presentation Im giving tomorrow so really need this sorted out soon.

Appreciate all help
Rahil

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.