apply-gen stylesheet version copy if provided

* src/transform/apply-gen.xsl: Use input stylesheet version if provided,
  otherwise 2.0.

* test/transform/apply-gen.xpsec: Test added
master
Mike Gerwitz 2016-07-05 00:15:35 -04:00
parent 1fc360bc1c
commit bb246b9bf2
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 26 additions and 1 deletions

View File

@ -62,7 +62,7 @@
<text>hoxsl; please do not modify</text>
</comment>
<out:stylesheet version="2.0">
<out:stylesheet version="{( @version, '2.0' )[ 1 ]}">
<!-- namespaces might be referenced in strings (e.g. @as), and so may
not be copied by default -->
<sequence select="namespace::*[ name() ]" />

View File

@ -40,6 +40,31 @@
</variable>
<!-- while functions are only supported in version >=2, this could be run
on future versions, and we want to make sure that we don't break
anything -->
<scenario label="stylesheet version">
<scenario label="when provided">
<context>
<xsl:stylesheet version="7.05" />
</context>
<expect label="is copied to output"
test="xsl:stylesheet/@version = '7.05'" />
</scenario>
<scenario label="when empty">
<context>
<xsl:stylesheet />
</context>
<expect label="defaults to 2.0"
test="xsl:stylesheet/@version = '2.0'" />
</scenario>
</scenario>
<!-- source namespaces must be copied -->
<scenario label="source namespaces">
<context>