Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: using variable in xpath(xsl:for-each)

From: George Bina <george@---------.--->
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






transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent