Re: [xsl] combination of copy-of and apply-templates

Subject: Re: [xsl] combination of copy-of and apply-templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 22 Nov 2006 12:34:04 GMT
> This does exactly what I want except for one thing: it also copies  
> the myhtml tag. What am I doing wrong?

Or rather it copies the myhtml element (xslt never processes tags)
You have an xsl:cop, un that template, simply remove it.
   <xsl:template match="myhtml">
       <xsl:copy>
         <xsl:apply-templates select="child::node()"/>
       </xsl:copy>
     </xsl:template>


should be

   <xsl:template match="myhtml">
         <xsl:apply-templates select="child::node()"/>
   </xsl:template>



  <xsl:template match="myhtml">
         <xsl:apply-templates/>
  </xsl:template>


as child::node()" is the default for apply templates.

Also      <xsl:template match="//mytag">
can be written as
     <xsl:template match="mytag">
as you never need to start a match pattern with // (it has no effect on
which nodes are matched, only on te hdefault priority)

David

Current Thread