xsl-list
[Top] [All Lists]

Re: copy of attributes

2004-10-21 01:48:40
Hi, news(_at_)swisslab(_dot_)de,

Thursday, October 21, 2004, 12:41:52 PM:
nsd> Hello List,

nsd> I want to performe a copy of an nodesets attributes. I can'nt use
nsd> xsl:copy-of, because I dont want to copy all the child nodes. Is it 
possible
nsd> to do this? Or do I have to copy each attribute manually by doing something
nsd> like this: 

nsd> <node>
nsd>   <xsl:attribute name="attr"><xsl:value-of
nsd> select="@attr"/></xsl:attribute>
nsd> </node>
For example:

<xsl:template name="attributes">
      <xsl:for-each select="attribute::*">
        <xsl:attribute name="{name()}">
              <xsl:value-of select="self::node()"/>
        </xsl:attribute>
      </xsl:for-each>
</xsl:template>

<xsl:template match="node">
 <node>
  <xsl:call-template name="attributes"/>
 </node>
</xsl:template>

--
Best regards,
Andrey V. Elsukov




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