Subject: Re: [xsl] xhtml xslt? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 25 Aug 2004 21:52:16 +0100 |
Hi Nathan, > but I am thinking that I could do something more generic like this > instead: > > <!-- copy all nodes and attributes --> > <xsl:template match="xhtml:node()|@*"> > <!--<xsl:message>Element <xsl:value-of > select="local-name()"/></xsl:message>--> > <xsl:copy> > <xsl:apply-templates select="@*|xhtml:node()"/> > </xsl:copy> > </xsl:template> > > However, the above does a copy, which is not what I want, as an > XHTML element may contain a custom element inside of it, so I really > need to do an apply-templates instead. The above isn't actually legal (you can't have "xhtml:node()"). What you probably meant was: <xsl:template match="xhtml:*"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> The above does an <xsl:apply-templates> on the content of the XHTML elements. > Also, I believe the above will copy all attributes on all nodes > right, when I only want to copy the attributes on xhtml: nodes. My revision above only matches XHTML elements, so it only does what it does with those elements. To copy XHTML elements and their attributes, I'd usually use: <xsl:template match="xhtml:*"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:copy> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xhtml xslt?, Nathan Shaw | Thread | Re: [xsl] xhtml xslt?, David Carlisle |
Re: [xsl] misc. confusion on "footn, Bruce D'Arcus | Date | Re: [xsl] Converting WordML to a XH, cking |
Month |