jian
jian

Reputation: 4877

How to pass a variable to a sgml file

Only in a single .sgml file, I have:

<ulink url="https://github.com/postgres/postgres/commit/2af07e2f7"> [2af07e2f7] </ulink>
<ulink url="https://github.com/postgres/postgres/commit/165d581f1"> [165d581f1] </ulink>,
<ulink url="https://github.com/postgres/postgres/commit/617f9b7d4"> [617f9b7d4] </ulink>

Is it possible to configure the base url, so I don't to need write
https://github.com/postgres/postgres/commit all the time?

So it will become something like:

<ulink url="$variable/2af07e2f7"> [2af07e2f7] </ulink>

in here: we have

<xsl:param name="base.dir" select="'html/'"></xsl:param>

https://git.postgresql.org/cgit/postgresql.git/tree/doc/src/sgml/stylesheet.xsl#n13

Maybe this is related.

Upvotes: 0

Views: 44

Answers (1)

imhotap
imhotap

Reputation: 2500

As far as I understood your question, you're looking for the SGML/XML entity mechanism (think text macros) explained in eg XML configuration inheritance, avoid duplications.

If you're actually using SGML (as opposed to mere XML), you can also use system-specific entities to have them defined outside of your document and supply their content via command-line parameters or other means. SGML (both SP and sgmljs) also treat references to undeclared entities by pulling content from a file named after the entity reference (see SGML syntax reference - Entities).

sgmljs also supports SGML templating, which is a way, like external entity references, to include SGML documents into host documents, but with attributes provided at the host document site supplied as parameters (entities) to the included document, and with type checking. Note the term parameter entity is used by SGML for entities to expand in markup declarations (to "parametrize a set of markup declarations" aka a DTD) as opposed to general entities which are expanded in content (which is what you're looking for).

Upvotes: 1

Related Questions