|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: replace xml element
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
|
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
|

Cart








