xsl-list
[Top] [All Lists]

[xsl] dynamic xpath from variable evaluate function is failing

2012-10-22 00:35:13
I need to construct the dynamic XPATH predicate from the input XML. I tried
with evaluate function, but  its not converting the String to XPATH
predicate. Can any one let me know how can I achieve this?

 Input: test.xml

<a>

<b test=3D=94(x=3DWindows)=94>content</b>

<b test=3D=94(z=3DUnix)=94>content</b>

<b test=3D=94(y=3DUnix) and (y=3DSolaris)=94>content</b>

<b test=3D=94(z=3DUnix) and (y=3DWindows7)=94>content</b>

</a>

Configuration/condition evaluation file (config.xml)

<root>

<condition name=3D=94x=94 value=3D=94Windows8=94/>

<condition name=3D=94z=94 value=3D=94Unix=94/>

<condition name=3D=94y=94 value=3D=94Solaris=94/>

<condition name=3D=94y=94 value=3D=94Windows7=94/>

</root>

XSLT: test.xsl

<xsl:variable name=3D"conlist"><s><xsl:for-each
select=3D"document('config.xml')// condition"><xsl:element
name=3D"{@name}">test</xsl:element><xsl:element
name=3D"{@value}">test</xsl:element></xsl:for-each></s></xsl:variable>

<xsl:template match=3D=94*[@test]=94>

<xsl:param name=3D"t" select=3D"concat('$', conlist,'//s','[',@test,']')"/>



<xsl:if test=3D'saxon:evaluate("$p1",$t)'>

<xsl:copy-of select=3D"."/>

</xsl:if>



</xsl:template>


Result:

I'm getting true for all above <b> elements

Expected result:

1st and 3rd <b> should not printed in the output (condition is failing)


Thanks in Advance,

Balaji. M

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