![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - using variable in xpath(xsl:for-each) [Thread Next] Re: using variable in xpath(xsl:for-each)To: NULL Date: 9/14/2007 12:34:00 AM
Hi Pallavi,
One way is to use the evaluate extension as mentioned in the previous
reply but in most cases you will not need that. For instance you can
write something like below in your case:
<xsl:variable name="localname" select="'FixedIncomeInstrument'"/>
<xsl:variable name="prefix" select="concat('FIXINC',':')"/>
<xsl:variable name="name" select="concat($prefix,$localname)"/>
<xsl:for-each select="*[name()=$name]">
<testP1 type="String">
<xsl:value-of select="test"/>
</testP1>
</xsl:for-each>
That is match on all elements that verify a condition and use the
variables in that condition to filter out the elements that you do not
want.
Note that the above is not namespace safe, a better approach will be
to check the local name and the namespace URI something like:
<xsl:for-each select="*[local-name()=$localname and namespace-
uri='http://your.FIXINC.namespace.here']">
...
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
