Subject: Re: [xsl] replacing nodes during xsl:copy-of From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 06 Jan 2011 14:06:35 +0000 |
Hi Guys
Thanks for the replies. Not sure why I'm having such a hard time getting my head around this. I couldn't get either of the proposed solutions to work, but it may just be a fundamental misunderstanding.
From a high-level, non-technical, viewpoint, what I need to do is convert the XML to HTML and either during the process, or after replace everything in the<replace> elements with something else. I'm guessing a 2-stage process is not the way to do it.
I'm using a pull approach rather than a push approach to do the transformation as the output is different depending on the nesting level. Each section can have text nodes (that contain HTML tags that I need to preserve). Any node can have a<replace> element in it.
My xsl is basically
<apply-templates select="Chapter"> <xsl:copy-of select="text"> <apply-templates select="Section"> <xsl:copy-of select="text"> <apply-templates select="Sub-Section"> <xsl:copy-of select="text"> <apply-templates select="clause"> <xsl:copy-of select="text">
You don't want all those select= attributes, just use <apply-templates/> or equivalently <apply-templates select="node()"/> to let xslt walk the tree in the correct order, otherwise you will get:
If I just use<apply-templates select="replace"> the replaced text is all in the wrong place in the output stream.
So can I use a 2-stage approach: e.g. use identity transform to convert all<replace> elements to required text and then feed this transformed output to my current transforms?
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] replacing nodes during xs, Martin Honnen | Thread | Re: [xsl] replacing nodes during xs, Andrew Welch |
[xsl] match first occurrence for wh, Robby Pelssers | Date | Re: [xsl] match first occurrence fo, David Carlisle |
Month |