xsl-list
[Top] [All Lists]

Re: [xsl] Changing the Attibute Value

2008-07-21 02:47:38
2008/7/21 Buddhi D. Mahindarathne <buddhi(_at_)exceltech-lanka(_dot_)com>:
This way I tried .. But no luck
       <xsl:template match="VisualObject[(_at_)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"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

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

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

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

</xsl:stylesheet>


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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