- From: Michael Kay <mike@saxonica.com>
- Date: Thu, 7 Feb 2008 09:45:26 -0000
- To: "'dave'" <ceek63@yahoo.com>, <xmlschema-dev@w3.org>
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/
Received on Thursday, 7 February 2008 09:45:35 UTC