forked from xspec/xspec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(xslt): illustrate existing XSpec reaction to XSLT default-mode (x…
…spec#1684) * Illustrate existing XSpec reaction to XSLT @default-mode * Rename runas=external tests
- Loading branch information
Showing
5 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
default-mode="implicit-default-mode" | ||
exclude-result-prefixes="xs" | ||
version="3.0"> | ||
|
||
<xsl:template match="*" as="element(no-explicit-mode)"> | ||
<no-explicit-mode/> | ||
</xsl:template> | ||
|
||
<xsl:template match="*" as="element(unnamed-mode)" | ||
mode="#unnamed" name="unnamed-mode-template"> | ||
<unnamed-mode/> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description | ||
xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
run-as="import" | ||
stylesheet="default-mode-parent.xsl" | ||
xslt-version="3.0"> | ||
|
||
<x:scenario label="x:context[not(@mode)]"> | ||
<x:context> | ||
<element/> | ||
</x:context> | ||
<x:expect> | ||
<x:label>Uses xsl:template[@mode='#unnamed']. When run-as='import', XSLT default-mode has no effect here.</x:label> | ||
<unnamed-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="x:context/@mode='implicit-default-mode'"> | ||
<x:context mode="implicit-default-mode"> | ||
<element/> | ||
</x:context> | ||
<x:expect> | ||
<x:label>Uses xsl:template[not(@mode)], to which XSLT @default-mode applies</x:label> | ||
<no-explicit-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="x:call by name, to template with mode='#unnamed'"> | ||
<x:context> | ||
<element/> | ||
</x:context> | ||
<x:call template="unnamed-mode-template"/> | ||
<x:expect> | ||
<x:label>Alternate way to reach xsl:template[@mode='#unnamed']</x:label> | ||
<unnamed-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
</x:description> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
version="3.0"> | ||
<xsl:include href="default-mode-included.xsl"/> | ||
</xsl:stylesheet> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description | ||
xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
run-as="external" | ||
stylesheet="default-mode-included.xsl" | ||
xslt-version="3.0"> | ||
|
||
<x:scenario label="x:context[not(@mode)]"> | ||
<x:context> | ||
<element/> | ||
</x:context> | ||
<x:expect> | ||
<x:label>Uses xsl:template[not(@mode)]. transform() uses XSLT @default-mode as initial mode.</x:label> | ||
<no-explicit-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="x:context/@mode='implicit-default-mode'"> | ||
<x:context mode="implicit-default-mode"> | ||
<element/> | ||
</x:context> | ||
<x:expect> | ||
<x:label>Uses xsl:template[not(@mode)], to which XSLT @default-mode applies. XSpec passes x:context/@mode to transform() as initial mode.</x:label> | ||
<no-explicit-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="x:call by name, to template with mode='#unnamed'"> | ||
<x:context> | ||
<element/> | ||
</x:context> | ||
<x:call template="unnamed-mode-template"/> | ||
<x:expect> | ||
<x:label>A way to reach xsl:template[@mode='#unnamed'] despite transform() using XSLT @default-mode as initial mode.</x:label> | ||
<unnamed-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
</x:description> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description | ||
xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
run-as="external" | ||
stylesheet="default-mode-parent.xsl" | ||
xslt-version="3.0"> | ||
|
||
<x:scenario label="x:context[not(@mode)]"> | ||
<x:context> | ||
<element/> | ||
</x:context> | ||
<x:expect> | ||
<x:label>Uses xsl:template[@mode='#unnamed']. Parent XSLT has no @default-mode, so transform() defaults to unnamed mode.</x:label> | ||
<unnamed-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="x:context/@mode='implicit-default-mode'"> | ||
<x:context mode="implicit-default-mode"> | ||
<element/> | ||
</x:context> | ||
<x:expect> | ||
<x:label>Uses xsl:template[not(@mode)], to which XSLT @default-mode applies. XSpec passes x:context/@mode to transform() as initial mode.</x:label> | ||
<no-explicit-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="x:call by name, to template with mode='#unnamed'"> | ||
<x:context> | ||
<element/> | ||
</x:context> | ||
<x:call template="unnamed-mode-template"/> | ||
<x:expect> | ||
<x:label>Alternate way to reach xsl:template[@mode='#unnamed']</x:label> | ||
<unnamed-mode/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
</x:description> |