Could someone help me decrypt this xpath expression?
<xsl:template match="n1:table/@* |
n1:thead/@* |
n1:tfoot/@* |
n1:tbody/@* |
n1:colgroup/@* |
n1:col/@* |
n1:tr/@* |
n1:th/@* |
n1:td/@*">
I believe it’s somewhere around:
Select all attributes from n1:table element AND all attributes from n1:thead element AND all attributes from n1:tfoot … etc.
I’m really not sure though.
Was reading this to get understand the xpath:
http://www.w3schools.com/xpath/xpath_syntax.asp
Care to give me a hint?
Thx.
You’ve basically got it right. The
|is the XPath’ union set operator:From http://www.w3.org/TR/xpath/#node-sets
But in patterns, from http://www.w3.org/TR/xslt#patterns
So the template matches for any attributes of table, thead, tbody, etc in the namespace referenced by
n1relative to the current context node.You’ll also need to account for the presence of a namespace in your source document using something like the following:
More on namespaces in XSLT templates:
http://radio-weblogs.com/0118231/stories/2006/10/03/xslt10PatternMatchingTipsForSourceDocumentsWithNamespaces.html