xsl-list
[Top] [All Lists]

Re: Using 'contains' function with xsl:key

2005-09-06 06:27:35
On 9/6/05, Gjergji Spaho <gjspaho(_at_)gmail(_dot_)com> 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'))]"/>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>