docbook / xslTNG

DocBook xslTNG Stylesheets
https://xsltng.docbook.org
MIT License
41 stars 20 forks source link

Cross Reference with xref: support for xrefstyle #414

Closed frank-steimke closed 5 months ago

frank-steimke commented 9 months ago

The template mechanism for cross references (xref) depends on xslt modes to get Information for the targeted element. One of the modes is called m:crossref-label. But the result is what i would call the "labelnumber". For the third chapter in a book it will give me the number 3, which is indeed part of the Headline for this Element, but maybe in a different presentation (e. g. roman III).

Is there any way to get the Label of the Headline in the Sense of "Chapter 3" or "Figure 2.1" or "Table 7" with text that will be generated by localization templates?

Background: for migration from XSLT 1 Stylesheets to xslTNG, i think some (a least limited) support for the xref/@xrefstyle Attribute is a must. There we have two mechanisms for customization of cross references, the select:... and the template:... method. In our own documents, we use <xref linkend='...' xrefstyle='select:label" /> frequently to get the generated Text "Tabelle 4" for Tables or "Abbildung 3.1" for Figures. In the "XSL complete guide" for the xslt 1 stylesheets, you find a description in chapter 15, Customizing cross references. Example: for a Table you have:

I am looking for a way do do the same thing with xslTNG, at least select:label. And for paged media a reference to a page number, here using the template: method: xrefstyle='template:Figure %n at page %p' for Figure 3.7 at page 121.

I admit that both methods, select: and template:, have disadvantages. But i am also sure that you dont want the same style of cross-references all the time, that would be a poor style of writing. xslTNG should therefore, and for the purpose of migration from XSLT 1.0, offer the support of xref/@xrefstyle.

Sorry for the long posting.

P. S. whats the difference between m:crossref-label and m:crossref-number modes?

Greetings, Frank

fsteimke commented 5 months ago

Issue can be closed, is done by pull request #446