You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Daniel Lopez <D....@uib.es> on 2000/09/28 17:51:09 UTC
XML with parameters?
Hi,
I was wondering whether there exists a standard method to retrieve, from
an XSLT sheet, the XML content using some parameters.
I explain myself with an example:
----- XML File -------
<MESSAGE
VALUE="Error in line $1 due to: $2."
/>
----- XSLT sheet might be something like ------
...
<xsl-value-of select="MESSAGE/@VALUE">
<with-parameter name="1">32</with-parameter>
<with-parameter name="2">number is not propperly
formated</with-parameter>
</xsl-value-of>
----- Result -----------
Error in line 32 due to: number is not propperly formated.
This would be easy if there was a function to substitute one string with
another, but AFAIK there is just a funcion, translate(), to substitute
characters. I know that I could do the same sort of thing using
substring-after, substring-before, blah, blah... but I was wondering
whether there was a cleaner solution before I try to reinvent the wheel.
I'm looking for something like what the class java.text.MessageFormat
does.
The reason why I want to do it is because I use XML files to store
application labels and then it becomes very easy to internationalise or
reuse the labels inside the application.
Thanks in advance,
Dan