Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - search and replace kind of operations with XML [Thread Next] RE: search and replace kind of operations with XMLTo: "'dave'" <ceek63@-----.--->, <xmlschema-dev@--.---> Date: 2/7/2008 9:45:00 AM I'm not sure why you're asking on an XML Schema list. I can't comment on XmlBeans, but you could do this either in XSLT or XQuery. In my view XSLT works better than XQuery for this kind of transformation, because of its built-in mechanism for doing a recursive descent of the tree, applying rules as you go. Typically you start with a rule that matches anything and copies it without change, recursing to process the next level: <xsl:template match="*"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> (there are variations of this depending on whether and how you want to process attributes) and then you provide specific rules for each kind of element that needs to be changed. For example the following rule changes <PRICE>12.00</PRICE> to <cost>10.00</cost> <xsl:template match="PRICE"> <cost> <xsl:value-of select="format-number(. - 2, '#.00')"/> </cost> </xsl:template> Hope this helps. Michael Kay http://www.saxonica.com/ From petexmldev@c... Thu Feb 07 10:22:43 2008 Received: from aji.w3.o | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
