|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Replacing Question
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: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








