Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Quick XSLT Question (http://www.velocityreviews.com/forums/t167563-quick-xslt-question.html)

Mike King 07-29-2004 01:27 PM

Quick XSLT Question
 
Does the following code have any defined behavior in XSLT or XPath? I have
tried this before and it didn't do what I thought it should do. Instead, I
had to use the local-name() function and compare it with a string
representing the element of interest.

<xsl:if test=". = SomeElement">
</xsl:if>



David Carlisle 07-29-2004 01:34 PM

Re: Quick XSLT Question
 
"Mike King" <emailMK@excite.com> writes:

> Does the following code have any defined behavior in XSLT or XPath? I have
> tried this before and it didn't do what I thought it should do. Instead, I
> had to use the local-name() function and compare it with a string
> representing the element of interest.
>
> <xsl:if test=". = SomeElement">
> </xsl:if>



it tests if the string value of the current node is equal to the string
value of its SomeElement child so if the current element is x it would
be true on

<x><a/><b/><SomeElement>aaa</SomeElement></x>

as they both have string value aaa.

You probably wanted

test="self::SomeElement"

which tests if the current node is a SomeElement element.

david

Mike King 07-29-2004 01:39 PM

Re: Quick XSLT Question
 
> it tests if the string value of the current node is equal to the string
> value of its SomeElement child so if the current element is x it would
> be true on
>
> <x><a/><b/><SomeElement>aaa</SomeElement></x>
>
> as they both have string value aaa.
>
> You probably wanted
>
> test="self::SomeElement"
>
> which tests if the current node is a SomeElement element.
>
> david



Thank you very much!




All times are GMT. The time now is 09:22 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.