[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi
if you want to print the text of the element, in the for loop,
Then you may have to do <xsl:value-of select = "text()"/> ( to get the text of the node ( excluding the text contained within any child element)
or
<xsl:value-of select = "."/> ( to get the text of the node ( including the text contained within any child element)
what you are doing is ../b which is the b element of its parent..
so in your case, when you loop through each b, and when you say <xsl:value-of select = "../b"> what happens is that the processor gets the parent node's all 'b'child elements...and since you are calling <xsl:value-of select> you allways get parent element's first 'b' child element for each b element. this is because value-of gives the string value of the first node in document order of the supplied node set.
_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] xsl:value-of
Subject: Re: [xsl] xsl:value-of From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx> Date: Mon, 01 Jul 2002 13:22:19 +0000 |
Hi
if you want to print the text of the element, in the for loop,
Then you may have to do <xsl:value-of select = "text()"/> ( to get the text of the node ( excluding the text contained within any child element)
or
<xsl:value-of select = "."/> ( to get the text of the node ( including the text contained within any child element)
what you are doing is ../b which is the b element of its parent..
so in your case, when you loop through each b, and when you say <xsl:value-of select = "../b"> what happens is that the processor gets the parent node's all 'b'child elements...and since you are calling <xsl:value-of select> you allways get parent element's first 'b' child element for each b element. this is because value-of gives the string value of the first node in document order of the supplied node set.
HTH Vasu
From: Cenk Uysal <cenk_uysal@xxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] xsl:value-of Date: Mon, 1 Jul 2002 05:44:44 -0700 (PDT)
hi,
I try to print same named tags one after another. my XML is just like this:
<a> <b at=""></b> <b at=""></b> <b at=""></b> </a>
I also have to control attributes of them. If they are valid, I will print them on screen.
Here is the part of XSL:
<xsl:for-each select="b[@at=$something]"> <xsl:value-of select="../b"/> </xsl:for-each>
But this time XSL prints first element all the time repeatedly. What can be the solution?
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:value-of, Oleg Tkachenko | Thread | [xsl] XSL: For-Each Efficient or No, Schrooten, Ben |
Re: Re: [xsl] Finding out the exist, Peter Davis | Date | Re: [xsl] Ignore namespaces, Jeni Tennison |
Month |