xsl-list
[Top] [All Lists]

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

2006-11-22 05:34:27

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>