| Subject: RE: [xsl] Replacing Question From: Jeff Beadle <Jbeadle@xxxxxxxx> Date: Fri, 15 Mar 2002 10:16:35 -0500 | 
Hey JB,
Here's a pattern based approach:
  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>
  <xsl:template match="Type">
    <xsl:copy>
      <xsl:choose>
        <xsl:when test="Name_of_Data/@Data_Key='test'">
          <xsl:copy>
            <Data>200</Data>
            <xsl:copy-of select="Name_of_Data"/>
          </xsl:copy>
        </xsl:when>
        <xsl:otherwise>
          <xsl:copy-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:copy>
  </xsl:template>
or, to be very specific:
  <xsl:template match="/">
    <xsl:apply-templates select="//Type[Name_of_Data/@Data_Key='test']"/>
  </xsl:template>
  <xsl:template match="Type[Name_of_Data/@Data_Key='test']">
    <xsl:copy>
      <Data>200</Data>
      <xsl:copy-of select="Name_of_Data"/>
    </xsl:copy>
  </xsl:template>
anyway, hope this helps.
-Jeff
-----Original Message-----
From: Joeri Belis [mailto:joeri.belis@xxxxxxxxxxxx]
Sent: Friday, March 15, 2002 8:34 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Replacing Question
hi, ( I am new to the XSLT env., so this may look trivial to you but no to
me )
This is an XML
<Type>
    <Data>100</Data>
    <Name_of_Data  Data_Key="test"/>
<Type>
How would i replace the data "text" 100 => 200 based on the fact that i want
to search on the name of the data
being the Data_key "test".
The output result should be
<Type>
    <Data>200</Data>
    <Name_of_Data  Data_Key="test"/>
<Type>
Thanks,
JB
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] Replacing Question, Joeri Belis | Thread | [xsl] Concealed, Wim Bontinck | 
| Re: [xsl] Are xsl:key's best going , Jeff Kenton | Date | Re: [xsl] Are xsl:key's best going , Trevor Nash | 
| Month |