Posted to tcl by mjanssen at Sat Feb 09 16:32:02 GMT 2008view raw
- package require tdom
- set xml {
- <A> <B a="4">test</B><B>test2</B></A>
- }
- set xslt {
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="//B">
- <xsl:element name="MyB">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*">
- <xsl:element name="{local-name()}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- </xsl:stylesheet>
- }
- dom parse $xml doc
- dom parse $xslt xsltdoc
- [$doc xslt $xsltdoc] asXML