the reason i have query2 is b/c i was trying to troubleshoot why my query1 (not shown) isn't working as it is using a choose/when/otherwise to set the query, so i simplified it to just set the value within the variable tags as shown (query2).
when i set the select of my for-each to query2 i get no results. when i set it to query3 it works fine.
At a first sight that seems a bit odd...I think it should be able to do it like you have posted above. But I would really love to see the context in, which you're using the variable so if you can post some more of your code it will be more easy to help you out I think.
The value-of instruction always returns a string - if the XPath matches more than one node, you'll get the string-value of the first node in that set.
You might be able to accomplish what you're after by using copy-of instead of value-of - but you have to use the node-set() function on the result, to be able to use XPath on that (but I can see you're already toying with that...)
setting xpath query in variable inconsistency
can someone explain to me why the following examples act differently and tell me what i should be doing instead?
query2
query3
the reason i have query2 is b/c i was trying to troubleshoot why my query1 (not shown) isn't working as it is using a choose/when/otherwise to set the query, so i simplified it to just set the value within the variable tags as shown (query2).
when i set the select of my for-each to query2 i get no results. when i set it to query3 it works fine.
thanks for any help
Hi David
At a first sight that seems a bit odd...I think it should be able to do it like you have posted above. But I would really love to see the context in, which you're using the variable so if you can post some more of your code it will be more easy to help you out I think.
/Jan
</xsl:template>
Thats the gist. my content tree is basically Home/Posts/2011/April/Post.
Hi David,
The value-of instruction always returns a string - if the XPath matches more than one node, you'll get the string-value of the first node in that set.
You might be able to accomplish what you're after by using copy-of instead of value-of - but you have to use the node-set() function on the result, to be able to use XPath on that (but I can see you're already toying with that...)
/Chriztian
Thanks Chriztian I finally got it using your advice. Your explaination was great!
Here's how i finally got it working.
is working on a reply...