Subject:Validate XPath on variable Author:Alex Keim Date:04 Aug 2008 05:37 AM
Hi,
can anybody tell me if something like following is possible? I'm reading the content of an XML-file into a variable and would like to validate if an XPath expression which is defined in the context actually matches a node within the variable's temporary tree.
$srcContent contains the expected data und XPathExpr contains an XPath that, if applied to the document, would find a match. Nevertheless if combined as above it's just not working.
Subject:Validate XPath on variable Author:(Deleted User) Date:04 Aug 2008 06:31 AM
Hi Alex,
XSLT does not allow to read text fragments from an XML document and treat them as literal XPath expressions; in order to do that, you need to use a non-standard extension function provided by your processor. Which processor are you using?
Subject:Validate XPath on variable Author:Alex Keim Date:04 Aug 2008 08:26 AM
Thanks for pointing me to the Saxon homepage, but I just don't get the point.
- $SrcContent ist the XML stored in a variable
- XPathExpr is in the current scope/context and contains the XPath that I want to evaluate against $SrcContent
Do I have to use saxon:parse() on $SrcContent like in
Subject:Validate XPath on variable Author:(Deleted User) Date:04 Aug 2008 09:12 AM
If your expression contains references to other namespaces, you will have to investigate which one of the other Saxon functions (eval(), expression() ) should be used to correctly prepare the context for parsing the XPath.