Re: [xsl] Put Xpath in variable

Subject: Re: [xsl] Put Xpath in variable
From: Abel Online <abel.online@xxxxxxxxx>
Date: Mon, 28 Aug 2006 15:30:34 +0200
Hi Matteo,

Not sure how your xml looks like. Here's a guess:

<field id="ViewState.desktop.content.runningActivities.activities.ShowTabs.tabItem.Show.content.ShowFncState.uxToShow.finder.currentFinder.ShowBasicSearchFinder.searchCriteria.criteria.subj.provMetadata.classMetadata" type="text" value="PROVINCIA" mode="read" />

Here's another guess:
<field>
<id>ViewState.desktop.content.runningActivities.activities.ShowTabs.tabItem.Show.content.ShowFncState.uxToShow.finder.currentFinder.ShowBasicSearchFinder.searchCriteria.criteria.subj.provMetadata.classMetadata</id>
<type>text</type>
<value>PROVINCIA</value>
<mode>read</mode>
</field>


In both scenario's it is quite straightforward to use a variable, depending on what your needs are. For instance:

<xsl:variable name="provider" select=" '.provMetadata.classMetadata' " />

In the XPath you could do the following:

<xsl:value-of select=" field / id [ contains ( . , $provider ) ] " />

which will select all id nodes having a text content that contains the string part as set in the variable. The next variant will do the same for the attribute version:

<xsl:value-of select=" field [ contains ( @id , $provider ) ] " />

HtH,

Abel Braaksma
http://www.nuntia.nl

m.core@xxxxxxxxxxxxxxxx wrote:

Hi all,
this is a piece of my xml tree (node name: field with ( instead of < )

(field id="ViewState.desktop.content.runningActivities.activities.ShowTabs.tabItem.Show.content.ShowFncState.uxToShow.finder.currentFinder.ShowBasicSearchFinder.searchCriteria.criteria.subj.provMetadata.classMetadata" type="text" value="PROVINCIA" mode="read" /)

i need to put the last two words of id (.provMetadata.classMetadata) in a variable... how can i do?

thx a lot for replies

Matteo

Current Thread