|
Subject: [xsl] [XSLT 3.0] A more efficient way to xsl:evaluate a bunch of XPath expressions against an XML document? From: "Costello, Roger L." <costello@xxxxxxxxx> Date: Sun, 11 Nov 2012 13:01:53 +0000 |
Hi Folks,
I have a bunch of xpath expressions stored in a file, xpaths.xml
I want to evaluate each of them against an XML document.
Here's how I implemented it:
<xsl:variable name="xpaths" select="doc('xpaths.xml')" />
<xsl:template match="Document">
<xsl:variable name="here" select="." />
<xsl:for-each select="$xpaths//xpath">
<xsl:variable name="xpath" select="." />
<xsl:for-each select="$here">
<xsl:evaluate xpath="$xpath" as="xs:boolean" />
</xsl:for-each>
</xsl:for-each>
</xsl:template>
I don't like that solution. Notice that I have a for-loop that spins through
each xpath expression. Then, in that for-loop I have an inner for-loop that
resets the context to the XML document. And in there is the xsl:evaluate
statement. This seems like an awful way to implement it.
Is there a better (simpler, more efficient) way to implement this?
/Roger
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] [Summary] 4 equivalent XP, Adam Retter | Thread | Re: [xsl] [XSLT 3.0] A more efficie, David Carlisle |
| Re: [xsl] [Summary] 4 equivalent XP, Adam Retter | Date | Re: [xsl] [XSLT 3.0] A more efficie, David Carlisle |
| Month |