Jump to content
  • Advertisement
Sign in to follow this  

[web] XSLT predicate

This topic is 4356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!