Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added use-id-as-filename parameter #560

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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