xsl-list
[Top] [All Lists]

Re: [xsl] Put Xpath in variable

2006-08-28 06:30:48
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(_dot_)core(_at_)aimconsulting(_dot_)it 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

--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>