I am developing an application were I need to transform XML documents that look like this:
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE markables SYSTEM "markables.dtd">
<markables>
<markable id="markable_1" mmax_level="coref" span="word_1..word_4"> </markable>
<markable id="markable_2" mmax_level="coref" span="word_6..word_7"> </markable>
<markable id="markable_3" mmax_level="coref" span="word_10..word_24"> </markable>
</markables>
Using a XSLT stylesheet. I would like the result of the transformation to be (in this case) word_1 word_6 word_10 and this is the XSL I am using:
<?xml version='1.0' encoding='ISO-8859-1'?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="markable">
<html>
<body>
<tr>
<td><xsl:value-of select="@span"/></td>
</tr>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The result is word_1..word_4 word_6..word_7 word_10..word_24. What do I have to change in the XSLT?
You need to use an XSLT function, namely
fn:substring-before(@span, '..')