What im trying to do is render the value of the document type parameter "flashfil", if it is set on the current page.If it is not set on the current page, i would like to check the parent node. And so on.
"Flashfil" is a radio button list with 2 options, which should return either 12 or 13
The above does'nt work. If my root node has "flashfil" set, the value is inherited down through all nodes.
It seems like it checks from level0 and downwoards and not from the current page and upwards...
I explained this in a previous post by @cultiv but I can't find it right now, so here goes a shorter version:
Whenever you do select in XPath, you get a set of nodes back - so your version will return 1, 2, 3 or more <flashfil> nodes. When you use value-of (or another function that returns a string) it will always take its value from the first node that matches.
The way the solution works is this:
"Select the ancestors (or current) that is a document node that doesn't have an empty "flashfil" property - take the first of those and return its flashfil property"
One tricky part is knowing that when you use the predicate [1] inside the expression, it matches the first node above $currentPage, but if you were to use it afterwards, it would match the topmost...
ancestor-or-self starts from level 0 ?
I havv the following xslt
What im trying to do is render the value of the document type parameter "flashfil", if it is set on the current page.If it is not set on the current page, i would like to check the parent node. And so on.
"Flashfil" is a radio button list with 2 options, which should return either 12 or 13
The above does'nt work. If my root node has "flashfil" set, the value is inherited down through all nodes.
It seems like it checks from level0 and downwoards and not from the current page and upwards...
Am i doing something wrong?
Hi Claus,
Try this:
/Chriztian
Thanks that works.
Could you elaborate at bit about the difference, and why one works and the other does'nt?
Maybe just a link to an article about it. Im really trying to get a hang of 4.5 schema, but its not always as simple as it seems...
Of course :-)
I explained this in a previous post by @cultiv but I can't find it right now, so here goes a shorter version:
Whenever you do select in XPath, you get a set of nodes back - so your version will return 1, 2, 3 or more <flashfil> nodes. When you use value-of (or another function that returns a string) it will always take its value from the first node that matches.
The way the solution works is this:
"Select the ancestors (or current) that is a document node that doesn't have an empty "flashfil" property - take the first of those and return its flashfil property"
One tricky part is knowing that when you use the predicate [1] inside the expression, it matches the first node above $currentPage, but if you were to use it afterwards, it would match the topmost...
Hope that helps,
/Chriztian
is working on a reply...