I’ve been trying to get a dictionary by mashing two different word lists together, but when I run it through Saxon it only repeats word #1 in wordlist2 on every row. It seems like Position() keeps returning 1 even though it’s looping? I’m new to this so everything is pretty confusing.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="Lexicon" select="document('./Lexicon.xml')"/>
<xsl:variable name="URI1" select="$Lexicon/lexicon/wordlist1"/>
<xsl:variable name="URI2" select="$Lexicon/lexicon/wordlist2"/>
<xsl:variable name="URI3" select="$Lexicon/lexicon/icon"/>
<xsl:variable name="Wordlist1" select="document($URI1)"/>
<xsl:variable name="Wordlist2" select="document($URI2)"/>
<xsl:variable name="Icon" select="document($URI3)"/>
<xsl:template match="/">
<html>
<body>
<xsl:copy-of select="$Icon"/>
<table border="1">
<tr bgcolor="#9acd32">
<td colspan="2">Lexicon from <xsl:value-of select="document($URI1)/wordlist/@lang"/> to <xsl:value-of select="document($URI2)/wordlist/@lang"/></td>
</tr>
<xsl:for-each select="$Wordlist1/wordlist/word">
<xsl:sort select="."/>
<tr>
<td><xsl:value-of select="."/></td>
<td><xsl:value-of select="$Wordlist2/wordlist/word[position()]"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I want it to list 10 words from file A, and then the 10 words from file B one word pair per row.
New contributor
Krulle Bandhagen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.