xsl-list
[Top] [All Lists]

Re: [xsl] xsl:copy-of issue

2010-01-13 18:14:15


On 14.01.2010 00:53, a kusa wrote:
Hi

I have a CALS table in my input thatI am trying to copy into my result
tree except for some attributes. I have tried 'except' but it just is
not working!

Here is my XSL snippet:

        <xsl:template match="table">
                <table id="{generate-id()}">
                        <xsl:copy-of select="@* except(@type) |node()/>
                                        </table>
        </xsl:template>

You are copying <table>'s attributes except @type, and then everything else (the tgroup element and its *unaltered* content). <emphasis> and its @type attribute will be part of the content that will be copied verbatim, and therefore it's still there in the output.

What you probably intended to use is a catch-all template like this:

  <xsl:template match="@* | *">
    <xsl:copy>
      <xsl:apply-templates select="@* except @type | * | text()" />
    </xsl:copy>
  </xsl:template>

Gerrit

--~------------------------------------------------------------------
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>