[NTG-context] Custom XML Export
Henning Hraban Ramm
texml at fiee.net
Sat Sep 12 14:28:42 CEST 2015
Am 2015-09-12 um 18:14 schrieb luigi scarso <luigi.scarso at gmail.com>:
>> Do you know a good XSLT processor except Saxon? Its free version is just too limited.
>
> xsltproc for xslt 1.0, but you are looking for xslt 2.0 , right ?
More like 3.0, I guess ;)
No, the only extension from commercial Saxon that I would need are global variables.
I didn’t yet dive into xsltproc’s (libxml2’s) documentation to see what might be possible.
E.g. if I don’t markup all my paragraphs (because it clutters the source too much and is tedious), I get <break />s between the original paragraphs. I could convert these to HTML <p>s like:
<xsl:variable name="within-paragraph">0</xsl:variable >
<xsl:template match="break">
<xsl:if test="within-paragraph = 0">
<xsl:text disable-output-escaping="yes"><![CDATA[</p><p>]]></xsl:text>
</xsl:if>
<xsl:if test="within-paragraph > 0">
<br />
</xsl:if>
</xsl:template>
<xsl:template match="paragraph">
<xsl:variable name="within-paragraph">1</xsl:variable >
<p><xsl:apply-templates/></p>
<xsl:variable name="within-paragraph">0</xsl:variable >
</xsl:template>
Maybe there’s another solution, but I’m not comfortable enough in XSL to see it.
Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)
More information about the ntg-context
mailing list