[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: contains() function to search general in xslt

Subject: Re: contains() function to search general in xslt
From: "Ragulf Pickaxe" <ragulf.pickaxe@xxxxxxxxxxx>
Date: Mon, 05 Dec 2005 13:09:08 +0100
xslt contains
Hi Raj,

		<xsl:if
test="contains(child::Box/@name,'Application')">
			<xsl:text>Box with Application is avaialble
</xsl:text>

Using the above code,
I got the output Box with Application is not
available.. Can tell me the reason? why it is not
checking the Box with a name 'Application'..

If you read up on contains, this function requires a value and a substring.
If value is not a string, it is converted to one, using the rules for string conversion.


child::Box/@name (which can be written much shorter as simply Box/@name - as the child axis is the default axis), returns a nodeset containing all the found name attributes. The string conversion rule explicitly states that it takes the string-value of the first node in document order. The first Box/@name you encounter has a string value of "header1", which is not what you are testing for.

You should be able to do something like:

<xsl:template match="Box[contains(@name,'Application')]">
 <xsl:text>Box with Application is avaialble</xsl:text>
</xsl:template>

So in your for-each, apply templates on Box elements, and have a template for each of your conditions.

I hope this helps.

Regards,
Ragulf Pickaxe :-)

_________________________________________________________________
Undge pop-ups med MSN Toolbar -  http://toolbar.msn.dk/ hent den gratis!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.