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

Re: Put Xpath in variable

Subject: Re: Put Xpath in variable
From: Abel Online <abel.online@xxxxxxxxx>
Date: Mon, 28 Aug 2006 15:30:34 +0200
xsl variable select xpath
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

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.