Y
yoni
Hi,
Consider the following XML document:
<article>
This is a sample <literal>document</literal>.
Some <literal>words</literal>, from some reason, are tagged with the
<literal>literal</literal> tag.
</article>
I'm using the following XSL to output html, where each literal is
surrounded by double quotes:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="literal">
<xsl:text>"</xsl:text>
<xsl:apply-templates/>
<xsl:text>"</xsl:text>
</xsl:template>
</xsl:stylesheet>
The result is the following:
<html>
This is a sample "document". Some "words", from some reason, are tagged
with the "literal" tag.
</html>
Problem is that this output doesn't obey the (somewhat strange) rules
of American English. The proper way to quote those literals would be:
This is a sample "document." Some "words," from some reason, are tagged
with the "literal" tag.
Notice that periods and commas that follow a literal end up being
inside the quotes.
My question is: Can anyone help me writing an XSL that would do this
quoting job correctly?
Thanks!
Yoni
Consider the following XML document:
<article>
This is a sample <literal>document</literal>.
Some <literal>words</literal>, from some reason, are tagged with the
<literal>literal</literal> tag.
</article>
I'm using the following XSL to output html, where each literal is
surrounded by double quotes:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="literal">
<xsl:text>"</xsl:text>
<xsl:apply-templates/>
<xsl:text>"</xsl:text>
</xsl:template>
</xsl:stylesheet>
The result is the following:
<html>
This is a sample "document". Some "words", from some reason, are tagged
with the "literal" tag.
</html>
Problem is that this output doesn't obey the (somewhat strange) rules
of American English. The proper way to quote those literals would be:
This is a sample "document." Some "words," from some reason, are tagged
with the "literal" tag.
Notice that periods and commas that follow a literal end up being
inside the quotes.
My question is: Can anyone help me writing an XSL that would do this
quoting job correctly?
Thanks!
Yoni