xsl-list
[Top] [All Lists]

Re: Using copy to change a node, whilst retaining the attributes

2003-08-04 11:42:35
John Reid wrote:
I would like to go from A to B, preferably
with code that copys across all attributes and does not copy across the
text node for <yes> but creates a new text node for <yes>
...
    <yes ID="20030722" WE="Tu">A</yes>
    <yes ID="20030729" WE="Tu">A</yes>
    <yes ID="20030805" WE="Tu">A</yes>
    <yes ID="20030809" WE="Sa">D</yes>
...
  <dates>
    <yes ID="20030722" WE="Tu">A</yes>
    <yes ID="20030729" WE="Tu">A</yes>
    <yes ID="20030805" WE="Tu">A</yes>
    <yes ID="20030809" WE="Sa">C</yes>

Try
  <xsl:template match="yes">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <!-- your logic for the text here -->
    </xsl:copy>
  </xsl:template>

Did you look into the FAQ?

J.Pietschmann


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list