Accepting request 1126556 from home:thomas-schraitle:branches:Publishing
- Raise version to 1.79.2.2 Integrate latest changes from assembly/assemble.xsl and assembly/effectivity.xsl - Remove docbook-xsl-1.79.2-assembly-assemble.xsl.patch We copy the two files directly. These two files contains the following overall changes: - Fix #254: Pass structure/@xml:lang to result doc - Support filterin/filterout elements - Fix problem with resourceref to another structure in assemblies - fix #28 assemble.xsl: imagedata filerefs in assembled output document may be incorrect - Fix #27 to allow merge from resource of titles not inside info because they are equivalent to titles inside info. Also fixe a couple of other problems noticed during testing. For details, see the upstream Git repo and run: $ git diff release/1.79.2..master -- \ xsl/assembly/assemble.xsl xsl/assembly/effectivity.xsl OBS-URL: https://build.opensuse.org/request/show/1126556 OBS-URL: https://build.opensuse.org/package/show/Publishing/docbook-xsl?expand=0&rev=9
This commit is contained in:
parent
f5b95cb3af
commit
e5f0b06c42
753
assemble.xsl
Normal file
753
assemble.xsl
Normal file
@ -0,0 +1,753 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:d="http://docbook.org/ns/docbook"
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://docbook.org/ns/docbook"
|
||||
exclude-result-prefixes="exsl d xlink d"
|
||||
version="1.0">
|
||||
|
||||
<xsl:include href="effectivity.xsl"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
<xsl:strip-space elements="d:assembly d:structure d:module d:resources d:resource"/>
|
||||
|
||||
<xsl:key name="id" match="*" use="@id|@xml:id"/>
|
||||
|
||||
|
||||
<xsl:param name="docbook.version">5.0</xsl:param>
|
||||
<xsl:param name="root.default.renderas">book</xsl:param>
|
||||
<xsl:param name="topic.default.renderas">section</xsl:param>
|
||||
|
||||
<xsl:param name="output.type" select="''"/>
|
||||
<xsl:param name="output.format" select="''"/>
|
||||
<!-- May be used to select one structure among several to process -->
|
||||
<xsl:param name="structure.id" select="''"/>
|
||||
|
||||
|
||||
<!-- default mode is to copy all content nodes -->
|
||||
<xsl:template match="node()|@*" priority="-5" mode="copycontent">
|
||||
<xsl:param name="omittitles"/>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*" mode="copycontent"/>
|
||||
<xsl:apply-templates mode="copycontent">
|
||||
<xsl:with-param name="omittitles" select="$omittitles"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<!-- process modules and structures encountered in resourceref content -->
|
||||
<xsl:template match="d:module" mode="copycontent">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:structure" mode="copycontent">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="processing-instruction('oxygen')"/>
|
||||
|
||||
<!-- skip assembly info elements -->
|
||||
<xsl:template match="d:info"/>
|
||||
|
||||
<!-- including for structure info element -->
|
||||
<xsl:template match="d:structure/d:info"/>
|
||||
|
||||
<!-- handle omittitles, but only top level title of resource -->
|
||||
<xsl:template match="/*/d:title
|
||||
| /*/d:info/d:title
|
||||
| /*/d:subtitle
|
||||
| /*/d:info/d:subtitle
|
||||
| /*/d:titleabbrev
|
||||
| /*/d:info/d:titleabbrev"
|
||||
mode="copycontent">
|
||||
<xsl:param name="omittitles"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$omittitles = 'yes' or $omittitles = 'true' or $omittitles = '1'">
|
||||
<!-- omit it -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*" mode="copycontent"/>
|
||||
<xsl:apply-templates mode="copycontent"/>
|
||||
</xsl:copy>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- handled in a mode -->
|
||||
<xsl:template match="d:resources"/>
|
||||
<xsl:template match="d:output|d:filterin|d:filterout|d:merge|d:revhistory"/>
|
||||
<xsl:template match="d:output|d:filterin|d:filterout|d:merge|d:revhistory"
|
||||
mode="copycontent"/>
|
||||
|
||||
<xsl:template match="d:assembly">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$structure.id != ''">
|
||||
<xsl:variable name="id.structure" select="key('id', $structure.id)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count($id.structure) = 0">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: structure.id param set to '</xsl:text>
|
||||
<xsl:value-of select="$structure.id"/>
|
||||
<xsl:text>' but no element with that xml:id exists in assembly.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
<xsl:when test="local-name($id.structure) != 'structure'">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: structure.id param set to '</xsl:text>
|
||||
<xsl:value-of select="$structure.id"/>
|
||||
<xsl:text>' but no structure with that xml:id exists in assembly.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="key('id', $structure.id)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="$output.type != '' and not(d:structure[@type = $output.type])">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: output.type param set to '</xsl:text>
|
||||
<xsl:value-of select="$output.type"/>
|
||||
<xsl:text> but no structure element has that type attribute. Exiting.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
<xsl:when test="$output.type != '' and d:structure[@type = $output.type]">
|
||||
<xsl:apply-templates select="d:structure[@type = $output.type][1]"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- otherwise process the first structure -->
|
||||
<xsl:apply-templates select="d:structure[1]"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:structure[not(@resourceref)]">
|
||||
|
||||
<xsl:variable name="output.root.element">
|
||||
<xsl:apply-templates select="." mode="compute.element.name"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:element name="{$output.root.element}" namespace="http://docbook.org/ns/docbook">
|
||||
<xsl:attribute name="version">
|
||||
<xsl:value-of select="$docbook.version"/>
|
||||
</xsl:attribute>
|
||||
<xsl:copy-of select="@xml:id|@xml:lang"/>
|
||||
|
||||
<!-- get any merge resource element before changing context -->
|
||||
<xsl:variable name="merge.resourceref" select="d:merge[1]/@resourceref"/>
|
||||
<xsl:variable name="merge.resource" select="key('id', $merge.resourceref)"/>
|
||||
|
||||
<!-- use the merge element if present -->
|
||||
<xsl:call-template name="merge.info">
|
||||
<xsl:with-param name="merge.element" select="d:merge"/>
|
||||
<xsl:with-param name="resource" select="$merge.resource"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="parent" select="$output.root.element"/>
|
||||
</xsl:apply-templates>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:glossary|d:bibliography|d:index|d:toc">
|
||||
<xsl:param name="parent" select="''"/>
|
||||
<xsl:apply-templates select="." mode="copycontent"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:title|d:titleabbrev|d:subtitle">
|
||||
<xsl:param name="parent" select="''"/>
|
||||
<xsl:apply-templates select="." mode="copycontent"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- module without a resourceref creates an element -->
|
||||
<xsl:template match="d:module[not(@resourceref)]">
|
||||
<xsl:param name="parent" select="''"/>
|
||||
|
||||
<xsl:variable name="module" select="."/>
|
||||
|
||||
<xsl:variable name="element.name">
|
||||
<xsl:apply-templates select="." mode="compute.element.name"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:element name="{$element.name}" namespace="http://docbook.org/ns/docbook">
|
||||
<xsl:choose>
|
||||
<!-- Use the module's xml:id if it has one -->
|
||||
<xsl:when test="@xml:id">
|
||||
<xsl:attribute name="xml:id">
|
||||
<xsl:value-of select="@xml:id"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<!-- get any merge resource element before changing context -->
|
||||
<xsl:variable name="merge.resourceref" select="d:merge[1]/@resourceref"/>
|
||||
<xsl:variable name="merge.resource" select="key('id', $merge.resourceref)"/>
|
||||
|
||||
<!-- use the merge element if present -->
|
||||
<xsl:call-template name="merge.info">
|
||||
<xsl:with-param name="merge.element" select="d:merge"/>
|
||||
<xsl:with-param name="resource" select="$merge.resource"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="parent" select="$element.name"/>
|
||||
</xsl:apply-templates>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="compute.renderas">
|
||||
<xsl:variable name="output.value">
|
||||
<xsl:call-template name="compute.output.value">
|
||||
<xsl:with-param name="property">renderas</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="$output.value"/>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- This utility template is passed a value for output format
|
||||
and the name of a property and computes the value
|
||||
of the property from output children of context element -->
|
||||
<xsl:template name="compute.output.value">
|
||||
<xsl:param name="property" select="''"/>
|
||||
|
||||
<xsl:variable name="default.format"
|
||||
select="ancestor::d:structure/@defaultformat"/>
|
||||
|
||||
<xsl:variable name="property.value">
|
||||
<xsl:choose>
|
||||
<!-- if a child output element has a format that matches the param value
|
||||
and it has that property -->
|
||||
<!-- The format attribute can be multivalued -->
|
||||
<xsl:when test="$output.format != '' and
|
||||
d:output[contains(concat(' ', normalize-space(@format), ' '),
|
||||
$output.format)]
|
||||
[@*[local-name() = $property]]">
|
||||
<xsl:value-of
|
||||
select="d:output[contains(concat(' ', normalize-space(@format), ' '),
|
||||
$output.format)]
|
||||
[@*[local-name() = $property]][1]
|
||||
/@*[local-name() = $property]"/>
|
||||
</xsl:when>
|
||||
<!-- try with the structure's @defaultformat -->
|
||||
<xsl:when test="$default.format != '' and
|
||||
d:output[contains(concat(' ', normalize-space(@format), ' '),
|
||||
$default.format)]
|
||||
[@*[local-name() = $property]]">
|
||||
<xsl:value-of
|
||||
select="d:output[contains(concat(' ', normalize-space(@format), ' '),
|
||||
$default.format)]
|
||||
[@*[local-name() = $property]][1]
|
||||
/@*[local-name() = $property]"/>
|
||||
</xsl:when>
|
||||
<!-- try the first output with the property-->
|
||||
<xsl:when test="d:output[@*[local-name() = $property]]">
|
||||
<xsl:value-of
|
||||
select="d:output[@*[local-name() = $property]][1]
|
||||
/@*[local-name() = $property]"/>
|
||||
</xsl:when>
|
||||
<!-- and try the module element itself -->
|
||||
<xsl:when test="@*[local-name() = $property]">
|
||||
<xsl:value-of
|
||||
select="@*[local-name() = $property]"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="$property.value"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:module[not(@resourceref)]" mode="compute.element.name">
|
||||
|
||||
<xsl:variable name="renderas">
|
||||
<xsl:call-template name="compute.renderas"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($renderas) != 0">
|
||||
<xsl:value-of select="$renderas"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: cannot determine output element name for </xsl:text>
|
||||
<xsl:text>module with no @resourceref and no @renderas. Exiting.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:module[@resourceref]" mode="compute.element.name">
|
||||
<xsl:param name="ref.name" select="''"/>
|
||||
|
||||
<xsl:variable name="renderas">
|
||||
<xsl:call-template name="compute.renderas"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($renderas) != 0">
|
||||
<xsl:value-of select="$renderas"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ref.name = 'topic' and
|
||||
string-length($topic.default.renderas) != 0">
|
||||
<xsl:value-of select="$topic.default.renderas"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($ref.name) != 0">
|
||||
<xsl:value-of select="$ref.name"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: cannot determine output element name for </xsl:text>
|
||||
<xsl:text>@resourceref="</xsl:text>
|
||||
<xsl:value-of select="@resourceref"/>
|
||||
<xsl:text>". Exiting.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:structure" mode="compute.element.name">
|
||||
<xsl:param name="ref.name" select="''"/>
|
||||
|
||||
<xsl:variable name="renderas">
|
||||
<xsl:call-template name="compute.renderas"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($renderas) != 0">
|
||||
<xsl:value-of select="$renderas"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($ref.name) != 0">
|
||||
<xsl:value-of select="$ref.name"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($root.default.renderas) != 0">
|
||||
<xsl:value-of select="$root.default.renderas"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: cannot determine output element name for </xsl:text>
|
||||
<xsl:text>structure with no @renderas and no $root.default.renderas. </xsl:text>
|
||||
<xsl:text>Exiting.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:module[@resourceref] | d:structure[@resourceref]">
|
||||
<xsl:param name="parent" select="''"/>
|
||||
|
||||
<xsl:variable name="module" select="."/>
|
||||
<xsl:variable name="resourceref" select="@resourceref"/>
|
||||
<xsl:variable name="resource" select="key('id', $resourceref)"/>
|
||||
|
||||
<!-- Determine whether a filterin or filterout element controls
|
||||
whether this module or structure should occur in the output
|
||||
document. -->
|
||||
<xsl:variable name="effectivity.exclude">
|
||||
<xsl:apply-templates select="child::d:filterin | child::d:filterout"
|
||||
mode="evaluate.effectivity" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="not($resource)">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: no xml:id matches @resourceref = '</xsl:text>
|
||||
<xsl:value-of select="$resourceref"/>
|
||||
<xsl:text>'.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($resource/self::d:resource)">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: xml:id matching @resourceref = '</xsl:text>
|
||||
<xsl:value-of select="$resourceref"/>
|
||||
<xsl:text> is not a resource element'.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:variable name="href.att" select="$resource/@href"/>
|
||||
|
||||
<xsl:variable name="fragment.id">
|
||||
<xsl:if test="contains($href.att, '#')">
|
||||
<xsl:value-of select="substring-after($href.att, '#')"/>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="filename">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($fragment.id) != 0">
|
||||
<xsl:value-of select="substring-before($href.att, '#')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$href.att"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="fileref">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$resource/ancestor::d:resources/@xml:base">
|
||||
<xsl:value-of
|
||||
select="concat($resource/ancestor::d:resources[@xml:base][1]/@xml:base,
|
||||
'/', $filename)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$filename"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($fileref) = 0">
|
||||
<!-- A resource without an @href value is an error -->
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: resource with @xml:id='</xsl:text>
|
||||
<xsl:value-of select="$resourceref"/>
|
||||
<xsl:text>' does not resolve to a filename.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="ref.file.content" select="document($fileref,/)"/>
|
||||
|
||||
|
||||
<!-- selects root or fragment depending on if $fragment is blank -->
|
||||
<xsl:variable name="ref.content.element"
|
||||
select="$ref.file.content/*[1][$fragment.id = ''] |
|
||||
$ref.file.content/*[1][$fragment.id != '']/
|
||||
descendant-or-self::*[@xml:id = $fragment.id]"/>
|
||||
|
||||
|
||||
|
||||
<xsl:variable name="ref.content.nodes">
|
||||
<xsl:apply-templates select="$ref.content.element" mode="ref.content.nodes"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="ref.content" select="exsl:node-set($ref.content.nodes)/*[1]"/>
|
||||
|
||||
<xsl:if test="count($ref.content) = 0">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: @href = '</xsl:text>
|
||||
<xsl:value-of select="$fileref"/>
|
||||
<xsl:text>' has no content or is unresolved.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:variable name="ref.name" select="local-name($ref.content)"/>
|
||||
|
||||
<xsl:variable name="element.name">
|
||||
<xsl:apply-templates select="." mode="compute.element.name">
|
||||
<xsl:with-param name="ref.name" select="$ref.name"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="omittitles.property">
|
||||
<xsl:call-template name="compute.output.value">
|
||||
<xsl:with-param name="property">omittitles</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="contentonly.property">
|
||||
<xsl:call-template name="compute.output.value">
|
||||
<xsl:with-param name="property">contentonly</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- get any merge resource element before changing context -->
|
||||
<xsl:variable name="merge.resourceref" select="$module/d:merge[1]/@resourceref"/>
|
||||
<xsl:variable name="merge.resource" select="key('id', $merge.resourceref)"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($effectivity.exclude, 'exclude')">
|
||||
<!-- Do not render a module if it includes a filterout
|
||||
element that includes an effectivity attribute that matches
|
||||
an effectivity parameter passed to the assembly stylesheet.
|
||||
Do not render a module if it includes a filterin element that
|
||||
does not match an effectivity parameter passed to the
|
||||
assembly stylesheet. -->
|
||||
</xsl:when>
|
||||
<xsl:when test="$contentonly.property = 'true' or
|
||||
$contentonly.property = 'yes' or
|
||||
$contentonly.property = '1'">
|
||||
<xsl:apply-templates select="$ref.content/node()" mode="copycontent">
|
||||
<xsl:with-param name="omittitles" select="$omittitles.property"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:when>
|
||||
<!-- use xsl:copy if using the ref element itself to get its namespaces -->
|
||||
<xsl:when test="$element.name = local-name($ref.content)">
|
||||
<!-- must use for-each to set context node for xsl:copy -->
|
||||
<xsl:for-each select="$ref.content">
|
||||
<xsl:copy>
|
||||
<xsl:attribute name="xml:base">
|
||||
<xsl:value-of select="$fileref"/>
|
||||
</xsl:attribute>
|
||||
<xsl:copy-of select="@*[not(name() = 'xml:id')]"/>
|
||||
<xsl:choose>
|
||||
<!-- Use the module's xml:id if it has one -->
|
||||
<xsl:when test="$module/@xml:id">
|
||||
<xsl:attribute name="xml:id">
|
||||
<xsl:value-of select="$module/@xml:id"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<!-- otherwise use the resource's id -->
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="@xml:id"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:call-template name="merge.info">
|
||||
<xsl:with-param name="merge.element" select="$module/d:merge"/>
|
||||
<xsl:with-param name="ref.content" select="$ref.content"/>
|
||||
<xsl:with-param name="omittitles" select="$omittitles.property"/>
|
||||
<xsl:with-param name="resource" select="$merge.resource"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- copy through all but titles, which moved to info -->
|
||||
<xsl:apply-templates select="node()
|
||||
[not(local-name() = 'title') and
|
||||
not(local-name() = 'subtitle') and
|
||||
not(local-name() = 'info') and
|
||||
not(local-name() = 'titleabbrev')]" mode="copycontent"/>
|
||||
|
||||
<xsl:apply-templates select="$module/node()">
|
||||
<xsl:with-param name="parent" select="$element.name"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:copy>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- create the element instead of copying it -->
|
||||
<xsl:element name="{$element.name}" namespace="http://docbook.org/ns/docbook">
|
||||
<xsl:attribute name="xml:base">
|
||||
<xsl:value-of select="$fileref"/>
|
||||
</xsl:attribute>
|
||||
<xsl:copy-of select="$ref.content/@*[not(name() = 'xml:id')]"/>
|
||||
<xsl:choose>
|
||||
<!-- Use the module's xml:id if it has one -->
|
||||
<xsl:when test="@xml:id">
|
||||
<xsl:attribute name="xml:id">
|
||||
<xsl:value-of select="@xml:id"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<!-- otherwise use the resource's id -->
|
||||
<xsl:when test="$ref.content/@xml:id">
|
||||
<xsl:attribute name="xml:id">
|
||||
<xsl:value-of select="$ref.content/@xml:id"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:call-template name="merge.info">
|
||||
<xsl:with-param name="merge.element" select="d:merge"/>
|
||||
<xsl:with-param name="ref.content" select="$ref.content"/>
|
||||
<xsl:with-param name="omittitles" select="$omittitles.property"/>
|
||||
<xsl:with-param name="resource" select="$merge.resource"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- copy through all but titles, which moved to info -->
|
||||
<xsl:apply-templates select="$ref.content/node()
|
||||
[not(local-name() = 'title') and
|
||||
not(local-name() = 'subtitle') and
|
||||
not(local-name() = 'info') and
|
||||
not(local-name() = 'titleabbrev')]" mode="copycontent"/>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="parent" select="$element.name"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:element>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- resolve resourceref reference to another structure into content -->
|
||||
<xsl:template match="d:structure" mode="ref.content.nodes">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="ref.content.nodes">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="merge.info">
|
||||
<xsl:param name="merge.element" select="NOTANODE"/>
|
||||
<xsl:param name="ref.content" select="NOTANODE"/>
|
||||
<xsl:param name="omittitles"/>
|
||||
<xsl:param name="resource"/>
|
||||
|
||||
<!-- a merge element may use resourceref as well as literal content -->
|
||||
<!-- any literal content overrides the merge resourceref content -->
|
||||
<xsl:variable name="merge.ref.content">
|
||||
<xsl:if test="$merge.element/@resourceref">
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="not($resource)">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: no xml:id matches @resourceref = '</xsl:text>
|
||||
<xsl:value-of select="$merge.element/@resourceref"/>
|
||||
<xsl:text>'.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($resource/self::d:resource)">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>ERROR: xml:id matching @resourceref = '</xsl:text>
|
||||
<xsl:value-of select="$merge.element/@resourceref"/>
|
||||
<xsl:text> is not a resource element'.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:variable name="href.att" select="$resource/@href"/>
|
||||
|
||||
<xsl:variable name="fileref">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$resource/ancestor::d:resources/@xml:base">
|
||||
<xsl:value-of
|
||||
select="concat($resource/ancestor::d:resources[@xml:base][1]/@xml:base,
|
||||
'/', $href.att)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$href.att"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:if test="string-length($fileref) != 0">
|
||||
<xsl:copy-of select="document($fileref,/)"/>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- Copy all metadata from merge.ref.content to a single node-set -->
|
||||
<xsl:variable name="merge.ref.nodes">
|
||||
<xsl:copy-of select="exsl:node-set($merge.ref.content)/*/d:title[1]"/>
|
||||
<xsl:copy-of select="exsl:node-set($merge.ref.content)/*/d:titleabbrev[1]"/>
|
||||
<xsl:copy-of select="exsl:node-set($merge.ref.content)/*/d:subtitle[1]"/>
|
||||
<xsl:copy-of select="exsl:node-set($merge.ref.content)/*/d:info[1]/node()"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="merge.ref.nodeset" select="exsl:node-set($merge.ref.nodes)"/>
|
||||
<!-- copy attributes separately so they can be applied in the right place -->
|
||||
<xsl:variable name="merge.ref.attributes" select="exsl:node-set($merge.ref.content)/*/d:info[1]/@*"/>
|
||||
|
||||
<xsl:variable name="omittitles.boolean">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$omittitles = 'yes' or $omittitles = 'true' or $omittitles = '1'">
|
||||
<xsl:value-of select="1"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="0"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!-- output info if there is any -->
|
||||
<xsl:if test="$merge.element/node() or
|
||||
$merge.ref.nodeset or
|
||||
$merge.ref.attributes or
|
||||
$ref.content/d:info/node() or
|
||||
$ref.content/d:title[$omittitles.boolean = 0] or
|
||||
$ref.content/d:subtitle[$omittitles.boolean = 0] or
|
||||
$ref.content/d:titleabbrev[$omittitles.boolean = 0]">
|
||||
|
||||
<xsl:variable name="ref.info" select="$ref.content/d:info"/>
|
||||
<xsl:variable name="ref.title" select="$ref.content/d:title"/>
|
||||
<xsl:variable name="ref.subtitle" select="$ref.content/d:subtitle"/>
|
||||
<xsl:variable name="ref.titleabbrev" select="$ref.content/d:titleabbrev"/>
|
||||
<xsl:variable name="ref.info.title" select="$ref.content/d:info/d:title"/>
|
||||
<xsl:variable name="ref.info.subtitle" select="$ref.content/d:info/d:subtitle"/>
|
||||
<xsl:variable name="ref.info.titleabbrev" select="$ref.content/d:info/d:titleabbrev"/>
|
||||
|
||||
<info>
|
||||
<!-- First copy through any merge attributes and elements and comments -->
|
||||
<xsl:copy-of select="$merge.element/@*[not(local-name(.) = 'resourceref')]"/>
|
||||
|
||||
<!-- add any attributes from the merge resource -->
|
||||
<xsl:copy-of select="$merge.ref.attributes"/>
|
||||
|
||||
<!-- And copy any resource info attributes not in merge-->
|
||||
<xsl:for-each select="$ref.info/@*">
|
||||
<xsl:variable name="resource.att" select="local-name(.)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$merge.element/@*[local-name(.) = $resource.att]">
|
||||
<!-- do nothing because overridden -->
|
||||
</xsl:when>
|
||||
<xsl:when test="$merge.ref.attributes[local-name(.) = $resource.att]">
|
||||
<!-- do nothing because overridden -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- copy through if not overridden -->
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- Copy through the merge children as they have highest priority -->
|
||||
<xsl:copy-of select="$merge.element/node()"/>
|
||||
|
||||
<!-- and copy through those merge resource elements not in merge element -->
|
||||
<xsl:for-each select="$merge.ref.nodeset/node()">
|
||||
<xsl:variable name="resource.node" select="local-name(.)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::processing-instruction()">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:when>
|
||||
<xsl:when test="self::comment()">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$merge.element/node()[local-name(.) = $resource.node]">
|
||||
<!-- do nothing because overridden -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- copy through -->
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- And copy any module's resource info node not in merge or merge.ref -->
|
||||
<xsl:for-each select="$ref.info/node() |
|
||||
$ref.title[$omittitles.boolean = 0] |
|
||||
$ref.subtitle[$omittitles.boolean = 0] |
|
||||
$ref.titleabbrev[$omittitles.boolean = 0] |
|
||||
$ref.info.title[$omittitles.boolean = 0] |
|
||||
$ref.info.subtitle[$omittitles.boolean = 0] |
|
||||
$ref.info.titleabbrev[$omittitles.boolean = 0]">
|
||||
<xsl:variable name="resource.node" select="local-name(.)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$merge.element/node()[local-name(.) = $resource.node]">
|
||||
<!-- do nothing because overridden -->
|
||||
</xsl:when>
|
||||
<xsl:when test="$merge.ref.nodeset/*[local-name(.) = $resource.node]">
|
||||
<!-- do nothing because overridden -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- copy through -->
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
|
||||
</info>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:relationships">
|
||||
<xsl:message>
|
||||
<xsl:text>WARNING: the <relationships> element is not currently </xsl:text>
|
||||
<xsl:text>supported by this stylesheet.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="d:transforms">
|
||||
<xsl:message>
|
||||
<xsl:text>WARNING: the <transforms> element is not currently </xsl:text>
|
||||
<xsl:text>supported by this stylesheet.</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,28 +0,0 @@
|
||||
From 6127d2e45b635dd073973b5aec81acf4d8df30b3 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Schraitle <tom_schr@web.de>
|
||||
Date: Wed, 19 Apr 2023 15:01:58 +0200
|
||||
Subject: [PATCH 1/1] Assembly: Copy xml:lang on <structure>
|
||||
|
||||
This is a first patch to copy the missing xml:lang attribute to the
|
||||
result file.
|
||||
It's still not yet clear, if this will be fixed upstream and how. Other
|
||||
attributes like role, os etc. might be also affected.
|
||||
|
||||
For details, see the docbook mailinglist:
|
||||
https://lists.oasis-open.org/archives/docbook/202304/msg00012.html
|
||||
---
|
||||
assembly/assemble.xsl | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff -ur docbook-xsl-1.79.2.bak/assembly/assemble.xsl docbook-xsl-1.79.2/assembly/assemble.xsl
|
||||
--- docbook-xsl-1.79.2.bak/assembly/assemble.xsl 2016-12-09 23:39:10.000000000 +0100
|
||||
+++ docbook-xsl-1.79.2/assembly/assemble.xsl 2023-04-19 14:54:16.562030329 +0200
|
||||
@@ -123,7 +123,7 @@
|
||||
<xsl:attribute name="version">
|
||||
<xsl:value-of select="$docbook.version"/>
|
||||
</xsl:attribute>
|
||||
- <xsl:copy-of select="@xml:id"/>
|
||||
+ <xsl:copy-of select="@xml:id|@xml:lang"/>
|
||||
|
||||
<!-- use the merge element if present -->
|
||||
<xsl:call-template name="merge.info">
|
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 9 09:27:14 UTC 2023 - Thomas Schraitle <thomas.schraitle@suse.com> 1.79.2.2
|
||||
|
||||
- Raise version to 1.79.2.2
|
||||
Integrate latest changes from assembly/assemble.xsl and
|
||||
assembly/effectivity.xsl
|
||||
- Remove docbook-xsl-1.79.2-assembly-assemble.xsl.patch
|
||||
We copy the two files directly.
|
||||
|
||||
These two files contains the following overall changes:
|
||||
|
||||
- Fix #254: Pass structure/@xml:lang to result doc
|
||||
- Support filterin/filterout elements
|
||||
- Fix problem with resourceref to another structure in assemblies
|
||||
- fix #28 assemble.xsl: imagedata filerefs in assembled output
|
||||
document may be incorrect
|
||||
- Fix #27 to allow merge from resource of titles not inside info
|
||||
because they are equivalent to titles inside info. Also fixe
|
||||
a couple of other problems noticed during testing.
|
||||
|
||||
For details, see the upstream Git repo and run:
|
||||
|
||||
$ git diff release/1.79.2..master -- \
|
||||
xsl/assembly/assemble.xsl xsl/assembly/effectivity.xsl
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 19 15:29:00 UTC 2023 - Thomas Schraitle <thomas.schraitle@suse.com> - 1.79.2.1
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
%define etcxmlcatalogd %{_sysconfdir}/xml/catalog.d
|
||||
#
|
||||
Name: docbook-xsl
|
||||
Version: 1.79.2.1
|
||||
Version: 1.79.2.2
|
||||
Release: 0
|
||||
Summary: XSL Stylesheets for DocBook
|
||||
License: MIT AND MPL-1.1
|
||||
@ -42,12 +42,14 @@ Source3: %{db5style_catalog}
|
||||
# Build scripts
|
||||
Source10: dbxslt-install.sh
|
||||
Source11: xslnons-build
|
||||
#
|
||||
Source20: assemble.xsl
|
||||
Source21: effectivity.xsl
|
||||
## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-dbtoepub.patch Fixed dirname
|
||||
Patch0: %{name}-dbtoepub.patch
|
||||
## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-non-recursive_string_subst.patch Use EXSLT replace function to avoid recursive implementation of string.subst
|
||||
Patch1: %{name}-non-recursive_string_subst.patch
|
||||
## PATCH-FIX-OPENSUSE docbook-xsl-1.79.2-assembly-assemble.xsl.patch Copy xml:lang of to result (assemble.xsl)
|
||||
Patch2: %{name}-%{realversion}-assembly-assemble.xsl.patch
|
||||
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: sgml-skel >= 0.7
|
||||
BuildRequires: unzip
|
||||
@ -145,7 +147,7 @@ tar xf %{SOURCE1} -C docbook-xsl-%{realversion}-ns --strip-components 1
|
||||
(cd docbook-xsl-%{realversion}-ns
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
# %%patch2 -p1
|
||||
|
||||
# Remove some Python and Java extensions
|
||||
# Remove dbtoepub Ruby script. This has been moved to devel:languages:ruby:extensions
|
||||
@ -192,6 +194,9 @@ mkdir -p %{buildroot}%{_sysconfdir}/xml/catalog.d \
|
||||
# The directory is already available at this point:
|
||||
install -m644 %{db4style_catalog} %{db5style_catalog} %{buildroot}%{etcxmlcatalogd}
|
||||
|
||||
# Overwrite our files from assembly directory
|
||||
cp %{SOURCE20} %{SOURCE21} %{buildroot}%{db5rootdir}/%{realversion}/assembly/
|
||||
|
||||
%fdupes -s %{buildroot}
|
||||
|
||||
%post -n %{db4package}
|
||||
|
386
effectivity.xsl
Normal file
386
effectivity.xsl
Normal file
@ -0,0 +1,386 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:d="http://docbook.org/ns/docbook"
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://docbook.org/ns/docbook"
|
||||
exclude-result-prefixes="exsl d xlink d"
|
||||
version="1.0">
|
||||
|
||||
<xsl:include href="../profiling/profile-mode.xsl"/>
|
||||
<xsl:include href="../common/addns.xsl"/>
|
||||
|
||||
<!-- NOTE: If a structure or module is filtered out due to a matching
|
||||
effectivity attribute, children of that structure or module cannot
|
||||
be filtered in using another effectivity attribute. -->
|
||||
|
||||
<xsl:param name="effectivity.arch" />
|
||||
<xsl:param name="effectivity.audience" />
|
||||
<xsl:param name="effectivity.condition" />
|
||||
<xsl:param name="effectivity.conformance" />
|
||||
<xsl:param name="effectivity.os" />
|
||||
<xsl:param name="effectivity.outputformat" />
|
||||
<xsl:param name="effectivity.revision" />
|
||||
<xsl:param name="effectivity.security" />
|
||||
<xsl:param name="effectivity.userlevel" />
|
||||
<xsl:param name="effectivity.vendor" />
|
||||
<xsl:param name="effectivity.wordsize" />
|
||||
<xsl:param name="effectivity.separator">;</xsl:param>
|
||||
|
||||
|
||||
<xsl:param name="profile.arch" select="$effectivity.arch"/>
|
||||
<xsl:param name="profile.audience" select="$effectivity.audience"/>
|
||||
<xsl:param name="profile.condition" select="$effectivity.condition" />
|
||||
<xsl:param name="profile.conformance" select="$effectivity.conformance"/>
|
||||
<xsl:param name="profile.os" select="$effectivity.os"/>
|
||||
<xsl:param name="profile.outputformat" select="$effectivity.outputformat"/>
|
||||
<xsl:param name="profile.revision" select="$effectivity.revision"/>
|
||||
<xsl:param name="profile.security" select="$effectivity.security"/>
|
||||
<xsl:param name="profile.userlevel" select="$effectivity.userlevel"/>
|
||||
<xsl:param name="profile.vendor" select="$effectivity.vendor"/>
|
||||
<xsl:param name="profile.wordsize" select="$effectivity.wordsize"/>
|
||||
<xsl:param name="profile.lang"/>
|
||||
<xsl:param name="profile.revisionflag"/>
|
||||
<xsl:param name="profile.role"/>
|
||||
<xsl:param name="profile.status"/>
|
||||
<xsl:param name="profile.attribute"/>
|
||||
<xsl:param name="profile.value"/>
|
||||
<xsl:param name="profile.separator" select="$effectivity.separator" />
|
||||
<!-- NOTE: The separator param is set to ; by default; this is ensure
|
||||
the conditional processing will work even if user does not pass in
|
||||
a separator -->
|
||||
|
||||
|
||||
<xsl:template match="d:filterout" mode="evaluate.effectivity">
|
||||
|
||||
<xsl:variable name="effectivity.match.arch">
|
||||
<xsl:if test="@arch and string-length($effectivity.arch) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.arch" />
|
||||
<xsl:with-param name="b" select="@arch" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.audience">
|
||||
<xsl:if test="@audience and string-length($effectivity.audience) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.audience" />
|
||||
<xsl:with-param name="b" select="@audience" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.condition">
|
||||
<xsl:if test="@condition and string-length($effectivity.condition) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.condition" />
|
||||
<xsl:with-param name="b" select="@condition" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.conformance">
|
||||
<xsl:if test="@conformance and string-length($effectivity.conformance) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.conformance" />
|
||||
<xsl:with-param name="b" select="@conformance" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.os">
|
||||
<xsl:if test="@os and string-length($effectivity.os) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.os" />
|
||||
<xsl:with-param name="b" select="@os" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.outputformat">
|
||||
<xsl:if test="@outputformat and string-length($effectivity.outputformat) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.outputformat" />
|
||||
<xsl:with-param name="b" select="@outputformat" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.revision">
|
||||
<xsl:if test="@revision and string-length($effectivity.revision) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.revision" />
|
||||
<xsl:with-param name="b" select="@revision" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.security">
|
||||
<xsl:if test="@security and string-length($effectivity.security) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.security" />
|
||||
<xsl:with-param name="b" select="@security" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.userlevel">
|
||||
<xsl:if test="@userlevel and string-length($effectivity.userlevel) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.userlevel" />
|
||||
<xsl:with-param name="b" select="@userlevel" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.vendor">
|
||||
<xsl:if test="@vendor and string-length($effectivity.vendor) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.vendor" />
|
||||
<xsl:with-param name="b" select="@vendor" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.wordsize">
|
||||
<xsl:if test="@wordsize and string-length($effectivity.wordsize) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.wordsize" />
|
||||
<xsl:with-param name="b" select="@wordsize" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$effectivity.match.arch = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the arch attribute value is set to <xsl:value-of select="$effectivity.arch" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.audience = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the audience attribute value is set to <xsl:value-of select="$effectivity.audience" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.condition = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the condition attribute value is set to <xsl:value-of select="$effectivity.condition" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.conformance = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the conformance attribute value is set to <xsl:value-of select="$effectivity.conformance" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.os = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the os attribute value is set to <xsl:value-of select="$effectivity.os" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.outputformat = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the outputformat attribute value is set to <xsl:value-of select="$effectivity.outputformat" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.revision = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the revision attribute value is set to <xsl:value-of select="$effectivity.revision" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.security = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the security attribute value is set to <xsl:value-of select="$effectivity.security" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.userlevel = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the userlevel attribute value is set to <xsl:value-of select="$effectivity.userlevel" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.vendor = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the vendor attribute value is set to <xsl:value-of select="$effectivity.vendor" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.wordsize = '1'">
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: filtering out a module or structure because the wordsize attribute value is set to <xsl:value-of select="$effectivity.wordsize" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:message>INFO: no filterout attributes matched.</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- filterin logic -->
|
||||
<xsl:template match="d:filterin" mode="evaluate.effectivity">
|
||||
|
||||
<xsl:variable name="effectivity.match.arch">
|
||||
<xsl:if test="@arch and string-length($effectivity.arch) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.arch" />
|
||||
<xsl:with-param name="b" select="@arch" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.audience">
|
||||
<xsl:if test="@audience and string-length($effectivity.audience) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.audience" />
|
||||
<xsl:with-param name="b" select="@audience" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.condition">
|
||||
<xsl:if test="@condition and string-length($effectivity.condition) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.condition" />
|
||||
<xsl:with-param name="b" select="@condition" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.conformance">
|
||||
<xsl:if test="@conformance and string-length($effectivity.conformance) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.conformance" />
|
||||
<xsl:with-param name="b" select="@conformance" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.os">
|
||||
<xsl:if test="@os and string-length($effectivity.os) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.os" />
|
||||
<xsl:with-param name="b" select="@os" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.outputformat">
|
||||
<xsl:if test="@outputformat and string-length($effectivity.outputformat) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.outputformat" />
|
||||
<xsl:with-param name="b" select="@outputformat" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.revision">
|
||||
<xsl:if test="@revision and string-length($effectivity.revision) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.revision" />
|
||||
<xsl:with-param name="b" select="@revision" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.security">
|
||||
<xsl:if test="@security and string-length($effectivity.security) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.security" />
|
||||
<xsl:with-param name="b" select="@security" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.userlevel">
|
||||
<xsl:if test="@userlevel and string-length($effectivity.userlevel) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.userlevel" />
|
||||
<xsl:with-param name="b" select="@userlevel" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.vendor">
|
||||
<xsl:if test="@vendor and string-length($effectivity.vendor) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.vendor" />
|
||||
<xsl:with-param name="b" select="@vendor" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="effectivity.match.wordsize">
|
||||
<xsl:if test="@wordsize and string-length($effectivity.wordsize) > 0">
|
||||
<xsl:call-template name="cross.compare">
|
||||
<xsl:with-param name="a" select="$effectivity.wordsize" />
|
||||
<xsl:with-param name="b" select="@wordsize" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$effectivity.match.arch = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO (filterin): including a module or structure because the arch attribute value is set to <xsl:value-of select="$effectivity.arch" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.audience = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the audience attribute value is set to <xsl:value-of select="$effectivity.audience" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.condition = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the condition attribute value is set to <xsl:value-of select="$effectivity.condition" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.conformance = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the conformance attribute value is set to <xsl:value-of select="$effectivity.conformance" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.os = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the os attribute value is set to <xsl:value-of select="$effectivity.os" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.outputformat = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the outputformat attribute value is set to <xsl:value-of select="$effectivity.outputformat" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.revision = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the revision attribute value is set to <xsl:value-of select="$effectivity.revision" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.security = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the security attribute value is set to <xsl:value-of select="$effectivity.security" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.userlevel = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the userlevel attribute value is set to <xsl:value-of select="$effectivity.userlevel" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.vendor = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the vendor attribute value is set to <xsl:value-of select="$effectivity.vendor" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$effectivity.match.wordsize = '1'">
|
||||
<xsl:text>include</xsl:text>
|
||||
<xsl:message>INFO: including a module or structure because the wordsize attribute value is set to <xsl:value-of select="$effectivity.wordsize" />.</xsl:message>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:text>exclude</xsl:text>
|
||||
<xsl:message>INFO: No modules or structures matched attributes for inclusion.</xsl:message>
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user