Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 10th, 2005, 12:42 PM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xsl:for-each

hello friends,

i have an xml file like this,

<Msge>
<md>
<itm attr1="abc">abc</itm>
.
.
</md>
<msg>
<thing>abc</thing>
</msg>
<msg>
<thing>def</thing>
</msg>
</Msge>

now i want to write an xsltstatement to compare the value of <thing> node and each value of <itm> node, and then display the attr1 value of the <itm> node.

i tried this condn
<xsl:for-each select="/Msge/md/itm">

<xsl:if test="<xsl:value-of select="/Msge/md/itm">=<xsl:value-of select="/Msge/msg/thing">">

<xsl:value-of select="/Msge/md/item/@attr1"/>

</xsl:if>
</xsl:for-each>

but i didnt get the ouptut.

how can i solve this problem.

regards
bharath

  #2 (permalink)  
Old August 11th, 2005, 07:48 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You only use xsl:value-of when outputting the value, so.
Code:
<xsl:if test="/Msge/md/itm = /Msge/msg/thing"></xsl:if>
But you have one itm and many thing elements. Why are you looping through itm and not thing?

--

Joe (Microsoft MVP - XML)


Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl:param and xsl:apply-templates' "select" newbieboobers XSLT 1 March 25th, 2008 07:23 PM
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
differnce between xsl:apply-templates and xsl:call chandu.mca007 XSLT 2 June 12th, 2007 04:12 AM
xsl advise needed - Replacing UID through XSL Billyl XSLT 6 February 28th, 2006 05:46 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.