xsl-list
[Top] [All Lists]

[xsl] replacing nodes during xsl:copy-of

2011-01-06 07:53:01
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">     


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?

Regards

mark


--~------------------------------------------------------------------
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>
--~--