Web Design and Development Forums

[HELP] XSL silly question

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

Old Sep 7th, 2006, 16:51   #1 (permalink)
New Member
 
Join Date: Sep 2006
Location: HK
Posts: 1
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
windbizz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 3rd, 2006, 06:54   #2 (permalink)
New Member
 
Join Date: Oct 2006
Location: Pune, India
Posts: 3
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,
svk2006 is offline  
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
Rate This Thread
Rate This Thread:

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 HTML Forum 6 Sep 4th, 2006 10:33
very silly and easy question saltedm8 HTML Forum 2 Aug 22nd, 2006 22:35



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 15:01.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59