Sign in to follow this  

[web] XSLT predicate

Recommended Posts

Hi guys, Say I have a node from an xml file:
<!-- XML NODE -->
   <node attr=1>
   <node attr=2>

and then i have some parameters in my xsl file: <xsl:param name="attrlvl" /> <xsl:param name="str" /> These paremters are set dynamically via some javascript. I'd like to be able to query a set of node's such that the set in question has @attr equal to attrlvl and the value of child1 (a string) contains str as a substring. <xsl:apply-templates select="nodeparent[$attrlvl=@attr and contains(child1,str)]" /> The problem with this is that what if I want to extract every node? That is, all nodes of any attr and child1 or any value. Is there a mechanism by which I can do this without doing a bunch of messy <xsl:choose>/<xsl:when> code? Another question: Since I am setting my <xsl:param> 's dynamically, I thought it would be useful if I had a parameter which contained my predicate. That way I could build my query string in javascript and then pass it to the XSLT processor. And then: <xsl:apply_templates select="nodeparent[$filterstring]"/> However, it doesnt seem to like it, and I dont know why. Any idea's? Thanks, metrix

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this