|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Dynamic XPath Expression
Is is possible to build up an XPath expression (as a string) and then use it
with a select or match. For example :-
If the variable $xPath contained the string value '/root/first' could I do :- <xsl:copy-of select='$xPath'/> I have to say from my initial testing this doesn't appear work and copy-of would just return the string itself not evaluate as an XPath expression, but I wondered whether there is a way of getting something like this to work ? What I'm trying to do is compare aspects of one XML instance with another. There are a lot of comparisons I need to make and I don't really want to hard code in each individual test's XPath in an 'if' statement. So I was considering creating templates which match the portions of the document I want to compare and from that context recursing through matching each node found with the corresponding structure in the other doc :- Doc 1 Doc 2 ==== ==== ... ... <Employees> <Employees> <Employee> <Employee> <FName>Fraser</FName> <-- OK --> <FName>Fraser</FName> <LName>Goffin</LName> <-- OK --> <LName>Goffin</LName> </Employee> </Employee> <Employee> <Employee> <FName>Luke</FName> <-- MISMATCH --> <FName>Marie</FName> <LName>Goffin</LName> <-- MISMATCH --> <LName>Smith</LName> </Employee> </Employee> ... ... </Employees> </Employees>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








