I create an XML using a my software (i. e. I have control over its structure). I want to use this XML to generate varying results by using different XSLT translation files. How can I generate varying texts in the result, depending on the XSLT in use?
More concrete:
My resulting documents shall contain either a "dots" character, i. e. …
or three dots, i. e. ...
, depending on the XSLT used. With one XSLT my XML shall result in the first, with another XSLT the same XML (!) shall result in the second. I need to write the XSLTs so that they translate the XML once to the one and once to the other.
My first approach was to replace a substring of the input. Various other questions exist for this topic but so far none fit my situation:
- using
…
in the XML and then usingreplace()
in XSLT — but I'm using XSLT 1.0 which doesn't contain this nice function. - using
…
in the XML and then usingtranslate()
in XSLT — but this can only translate one character to one character, while I need to have...
as one of the outputs (i. e. more than one character). - using entities (e. g.
&dots;
) in the XML and have the XSLT expand these to varying strings — the only approach for doing this I found treated the entities exactly like any other string, so no solution found for this either. I still hope I just didn't find a nice and easy solution using this approach.
There were laborious solutions for implementing a replace()
-like thing in XSLT 1.0. Before using these I'd rather create different XMLs :-/
I'm surprised that my problem seems so hard to solve and have the feeling I've overlooked something simple.