xsl-list
[Top] [All Lists]

problems with xsl:copy instruction

2005-05-26 07:28:19
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>