[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] problems with xsl:copy instruction
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|