That was where I was looking for. Thanks! I already tried something like that, but I think I misused the β|β-operator, instead of the βorβ-operator. Despite http://www.w3schools.com/xpath/xpath_operators.asp as a reference, I still do not fully understand what makes the difference between these two operators.
You can think of the pipe ( | ) as a join operator - it will join the nodes of two nodesets into a single nodeset; The or operator is just a boolean operation that works as you're used to in countless other languages.
Select Nodes of a specific Document Type - Pass Document Type by Param
I know how to select nodes of a specific document type, i.g. select nodes of document type 'News':
But... now I want to pass the name of the specific document type to the xslt file by Param. Something like:
Unfortunately, I get a 'Unexpected token' error, I cannot use the $-sign.
Any suggestions how to solve this?
I'd really appreciate it!
Hi RJ,
You can use the name() function to perform that test/selection, e.g. to select all documents of a specific type:
/Chriztian
Hi,
You can use a variable for a document type alias by using the name() function:
Hope this helps,
Tom
Hello Chriztian, Tom,
Indeed, the function name() did the trick. Thanks! Currently my select statement looks like this and it works:
Suggestions to make this shorter are welcome. The select statement should select all nodes that are either a News item or an Activity.
Hi RJ,
You can shorten that a bit by way of combining the name() tests inside the same predicate:
That way, you're also getting rid of the duplication, which is a good thing(TM)
/Chriztian
Hello Chriztian,
That was where I was looking for. Thanks! I already tried something like that, but I think I misused the β|β-operator, instead of the βorβ-operator. Despite http://www.w3schools.com/xpath/xpath_operators.asp as a reference, I still do not fully understand what makes the difference between these two operators.
Hi RJ,
You can think of the pipe ( | ) as a join operator - it will join the nodes of two nodesets into a single nodeset; The or operator is just a boolean operation that works as you're used to in countless other languages.
/Chriztian
Hello Chriztian,
Thanks for your explanation. It was a great help.
is working on a reply...