Am 2015-09-15 um 00:09 schrieb Jan Tosovsky <j.tosov...@email.cz>:

> XSLT 1.0 is capable to handle anything (turing machine).
> XSLT 2.0 brings some syntactic sugar.
> XSLT 3.0 supports streaming.
> 
> If you need 2.0 features, you can use Saxon-B 9.1.0.8 (free, but not
> maintained any more).

Thank you, I’ll first try xsltproc.

>> ... I would need are global variables.
> 
> In pure XSLT any variable is fixed and its value cannot be changed. There
> are, however, different approaches how to accomplish this. Most common is
> defining template parameters and passing the proper values via them, see
> below.
> 
>> 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>
> 
> 
> <xsl:template match="your-element" name="your-element">
>   <!-- default value -->
>   <xsl:param name="within-paragraph" select="0"/>
>   <!-- your code -->
> </xsl:template>
> 
> <xsl:apply-templates select="your-element">
>   <!-- overriding a default value -->
>   <xsl:with-param name="within-paragraph" select="1">
> </xsl:apply-templates>

Thank you very much!


> Btw, istead of 
> <xsl:text disable-output-escaping="yes"><![CDATA[</p><p>]]></xsl:text>
> 
> you can write 
> <p/>

No, </p><p> ist not <p></p>!

I want to get from

text text text
<break />
text text text

(when I don’t use \start/stopparagraph)

to

<p>
text text text
</p>
<p>
text text text
</p>

But *if* there is paragraph markup, <break /> should become <br />. That’s why 
I tried to use a status variable to know if there was a explicit paragraph 
start.


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to