This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Altering specific value then outputing tree.
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Altering specific value then outputing tree.
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 11 Jul 2001 17:36:28 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> I want to be able to output the above piece of XML in my
> output document, and I
> can do this fine by doing an <xsl:copy-of select="//person"/>
> but I want to be
> able to change the value of the member_number tag before
> outputing the above so
> that it contains a number. I am going to get the value for
> the member_number
> from elsewhere within my XML document. Is there an easy way
> of doing this
> rather than a <xsl:copy-of..> of each individual element
> within the above
> tree??
Write an identity template rule for most elements:
<xsl:template match="*">
<xsl:copy-of select="*"/>
<xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>
and override it with a special rule for member_number
<xsl:template match="member_number">
<member_number><xsl:value-of select="..."/></member_number>
</xsl:template>
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list