Subject: Re: [xsl] replace xml element From: Mike Brown <mike@xxxxxxxx> Date: Wed, 1 May 2002 19:23:04 -0600 (MDT) |
valerie liston wrote: > Thanks Jeni, I'll give that a try but also I was just wondering is there a > possibility of doing some sort of search and replace in xslt, ie. search > through the whole xml doc and replace any occurrence of the tag <break/> > with <br/>? XSLT doesn't operate on an XML document as a string, it operates on a node tree (kind of like the one implied by the DOM). You don't have access to the serialized markup, so the answer to your question is "no", if you're asking what I think you're asking. However, the answer Jeni gave you was correct and achieves what you want. You can visit every node in the document, making a copy of it along the way. When you are visiting an element named 'break', you can have it be processed by a different template that creates an empty 'br' element. The recursive visit-and-copy algorithm is called the 'identity transform' and is demonstrated in the XSLT spec in the section on copying (xsl:copy). The template to add to that example is just like the one Jeni said: <xsl:template match="break"> <br/> </xsl:template> - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] replace xml element, valerie liston | Thread | RE: [xsl] replace xml element, Michael Kay |
[xsl] Processing formatted XML?, Robert Nicholson | Date | RE: [xsl] Recursion Help with Summi, Sal Mangano |
Month |