Created
June 27, 2013 00:14
-
-
Save nine9ths/5872951 to your computer and use it in GitHub Desktop.
Demonstrate differences between xsl:apply-imports and xsl:next-match for controlling import precedence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
exclude-result-prefixes="xs"> | |
<xsl:template match="foo"> | |
<bar/> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
exclude-result-prefixes="xs"> | |
<xsl:import href="test.apply-imports.imported.xsl"/> | |
<xsl:variable name="test" as="element(foo)"> | |
<foo/> | |
</xsl:variable> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="$test"/> | |
</xsl:template> | |
<xsl:template match="foo"> | |
<test> | |
<xsl:next-match/> <!-- This will return <baz/> --> | |
<xsl:apply-imports/> <!-- This will return <bar/> --> | |
</test> | |
</xsl:template> | |
<xsl:template match="*"> | |
<baz/> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment