[HELP] XSL silly question

This is a discussion on "[HELP] XSL silly question" within the Other Programming Languages section. This forum, and the thread "[HELP] XSL silly question are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Other Programming Languages

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 7th, 2006, 16:51
New Member
Join Date: Sep 2006
Location: HK
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question [HELP] XSL silly question

Hi, I am a newbie in XML and XSL, and having the following XSL question.

The XML data:
<document>
<segment Id="A">
<type Id="A01">Blue</type>
<type Id="A02">Water</type>
</segment>
<segment Id="A">
<type Id="A01">Green</type>
<type Id="A02">Grass</type>
</segment>
</document>

Problem: I would like to select the value of "A02" when the "A01" is Green. How can it be implemented in XSL? Any help will be much appreciated!!

Windbizz
from HK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 3rd, 2006, 06:54
New Member
Join Date: Oct 2006
Location: Pune, India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [HELP] XSL silly question

Hello,
please try following xsl for your problem....

<?xml version="1.0"?>
<xsl:stylesheet xmlnssl="
http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="segment">
<P>
Segment matched<xsl:value-of select="@Id"/>
<xsl:for-each select="type">
<xsl:if test=".='Green' and @Id='A01'"><br>
Value of A02 when A01 is Green:</br>
<xsl:for-each select="../type">
<xsl:choose>
<xsl:when test="@Id='A02'">
<xsl:value-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</P>
</xsl:template></xsl:stylesheet>


Does this solve your problem?
Regards,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
help, xsl, silly, question

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Silly Golf jimboready Free Web Site Critique 2 Feb 29th, 2008 13:57
Help!! A silly Question nutbolt Flash & Multimedia Forum 4 Feb 7th, 2007 16:30
Silly Question ScottR PHP Forum 3 Nov 4th, 2006 21:14
Probably a VERY silly question but... dharma Web Page Design 6 Sep 4th, 2006 10:33
very silly and easy question saltedm8 Web Page Design 2 Aug 22nd, 2006 22:35


All times are GMT. The time now is 03:29.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42