Skip to content

Commit

Permalink
Merge pull request #560 from ndw/iss-558
Browse files Browse the repository at this point in the history
Added use-id-as-filename parameter
  • Loading branch information
ndw authored Nov 10, 2024
2 parents 71de04f + d2ad1a3 commit 6e82c1c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/guide/xml/ch02.xml
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,21 @@ chunks.</para>
navigation aids are constructed.</para>
</listitem>
</varlistentry>
<varlistentry><term><parameter>use-id-as-filename</parameter></term>
<listitem>
<para>If this parameter <glossterm>is true</glossterm>, the <tag class="attribute">xml:id</tag>
on a chunk will be used to construct the filename for that chunk. You can also control
the chunk filename on a per-chunk basis with the
<literal>db</literal> processing instruction
<indexterm>
<primary>db processing instruction</primary>
</indexterm> using the <literal>filename</literal><indexterm>
<primary>db processing instruction</primary>
<secondary>filename pseudo-attribute</secondary>
</indexterm> pseudo-attribute.</para>
</listitem>
</varlistentry>

</variablelist>

<section xml:id="chunk-navigation">
Expand Down
5 changes: 5 additions & 0 deletions src/guide/xml/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ the combination of options. See <xref linkend="verbatim-environments"/>.</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Added <parameter>use-id-as-filename</parameter> parameter. If true,
the <tag class="attribute">xml:id</tag> value of a chunk will be used as the
chunk filename.</para>
</listitem>
</itemizedlist>
</section>

Expand Down
21 changes: 21 additions & 0 deletions src/guide/xml/ref-params.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5877,4 +5877,25 @@ The default language only applies to <tag>programlisting</tag> elements.</para>
</refsection>
</refentry>

<refentry>
<refmeta>
<fieldsynopsis>
<type>xs:string</type>
<varname>use-id-as-filename</varname>
<initializer>'false'</initializer>
</fieldsynopsis>
<refmiscinfo class="version">2.5.0</refmiscinfo>
</refmeta>
<refnamediv>
<refpurpose>Use id as filename when chunking</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>

<para>If this parameter <glossterm>is true</glossterm>, when a document is being
chunked, the <tag class="attribute">xml:id</tag> of a chunk will be used as the filename
unless a processing instruction overrides it.</para>
</refsection>
</refentry>

</reference>
3 changes: 3 additions & 0 deletions src/main/xslt/modules/chunk.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@
<xsl:when test="f:pi($node/db:info, 'basename')">
<xsl:sequence select="f:pi($node/db:info, 'basename') || $html-extension"/>
</xsl:when>
<xsl:when test="$node/@xml:id and f:is-true($use-id-as-filename)">
<xsl:sequence select="$node/@xml:id || $html-extension"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="name" as="xs:string?">
<xsl:apply-templates select="$node" mode="m:chunk-filename"/>
Expand Down

0 comments on commit 6e82c1c

Please sign in to comment.