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

Re: Using 'contains' function with xsl:key

Subject: Re: Using 'contains' function with xsl:key
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 6 Sep 2005 14:27:35 +0100
xsl contains function
On 9/6/05, Gjergji Spaho <gjspaho@xxxxxxxxx> wrote:
> Hi everyone!
> I have a XML with elements that have an id attribute.
> The value of the id attribute is composed in one of the two ways:
>
> 1) '_field:' + valid string + number
> 2)'_group:' + valid string + number
>
> All i want is to create two different groups based on the first word
> of the attribute value : '_field'  or 'group'.
>
> One way is:
> <xsl:key name="ctlkey" match="*" use="substring-before(@id,':')"/>
>
> and use it
> key('ctlkey','_field') or key('ctlkey','_group')
>
> now my quetion is:
> Is it possible to have the xsl:key defined:
>
> <xsl:key name="ctlkey" match="*" use="contains(@id,'_field')"/>
>
> and then use it
>
> key('ctlkey',true()) or key('ctlkey',false()) ??????

You don't need a key for that, just use:

<xsl:apply-templates select="//*[contains(@id,'_field')]"/>

and

<xsl:apply-templates select="//*[not(contains(@id,'_field'))]"/>

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.