[Home] [By Thread] [By Date] [Recent Entries]
Martin Honnen wrote:
Mike Stroud wrote: Here is an example: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="DIMENSIONS">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template><xsl:template match="DIMENTION"> <xsl:copy> <xsl:analyze-string select="." regex="\s+T=(\d+)\s+(\d+)\s+x\s+(\d+)"> <xsl:matching-substring> <Length> <xsl:value-of select="regex-group(1)"/> </Length> <Width> <xsl:value-of select="regex-group(2)"/> </Width> <Mass> <xsl:value-of select="regex-group(3)"/> </Mass> </xsl:matching-substring> </xsl:analyze-string> </xsl:copy> </xsl:template> </xsl:stylesheet> Note that you use the odd spelling "DIMENTION" in your XML input sample so the match attribute uses that spelling too. -- Martin Honnen http://JavaScript.FAQTs.com/
|

Cart



