Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: does xpath expressions/matches support variables?

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 6/4/2006 8:58:00 AM


"stoj" <stoj@d...> wrote in message
news:AD9BDA51-058A-4006-8CC4-1369D77C1745@m......
> I need to use a variable (similar scenario also for a template parameter)
> that has been assigned with an xpath string as an xpath expression/match
for
> xsl elements such as xsl:if, xsl:what, xsl:template, etc.
>
> Eg. xsl snippet - intended to invoke execute-code block if the node
exists.
> It works perfectly if i replace "$var" with "/root/parent/child".
>
> <xsl:variable name="var">/root/parent/child</xsl:variable>
> <xsl:if test="$var">
> ...execute-code
> </xsl:if>
>
> 1. Observed behaviour is that the if statement always fires.  Presumably
> because it is resolving to <xsl:if test="'/root/parent/child'">, which
> resolves to true.  If this is true, how can i change this to <xsl:if
> test="/root/parent/child">?  Is there a function availble to strip away
the
> extra quotations?
>
> 2. Does anyone know of a *clean* design pattern to solve this?  Preferably
> one that i can call as a generic template/function to allow it to called
at
> whim.
>
> cheers
> stoj

What you are trying to do is create Dynamic XSL that is XSL that changes as
it's processed.  This is not possible since the XSL is parsed and compiled
in to a processing engine which can not be modified on the fly.

We would need to know more about what you are doing to offer any serious
help.

Some things that might help are xsl:choose, extensive use of templates and
the mode attribute.

Anthony.




transparent
Print
Mail
Like It
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