Re: [xsl] Changing the Attibute Value

Subject: Re: [xsl] Changing the Attibute Value
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 21 Jul 2008 10:47:12 +0100
2008/7/21 Buddhi D. Mahindarathne <buddhi@xxxxxxxxxxxxxxxxxxx>:
> This way I tried .. But no luck
>        <xsl:template match="VisualObject[@xsi:type='CChamferEx']">
>                <xsl:template match="Name[. = 'ChamferedRectangle']">
>                        <xsl:copy>Fillet</xsl:copy>
>                </xsl:template>
>        </xsl:template>

I can see what you're thinking, but you can't do that.  I know others
are trying not to just give you the code, but as far as I'm concerned
using xsl:apply-templates within xsl:copy is one of the hardest things
to grasp in XSLT - I remember it taking me ages to get it.  It's
probably best to start with a working example, and go from there.

The stylesheet below does most of what you asked, you just need to add
an extra template to handle the address element:

<xsl:stylesheet version="1.0"

   <xsl:template match="@* | node()">
         <xsl:apply-templates select="@* | node()"/>

  <xsl:template match="VisualObject[@xsi:type='CChamferEx']">
      <xsl:copy-of select="@*"/>
      <xsl:attribute name="xsi:type">CFilletEx</xsl:attribute>
      <xsl:apply-templates select="node()"/>

  <xsl:template match="Name[. = 'ChamferedRectangle1']">


Andrew Welch

Current Thread