好的。将尝试解释我想要做什么..对一个xml文件进行排序,并获得另一个xml文件
我有一个XSL文件,读取两个XML文件。这两个xml文件都包含单词。一个文件中英文单词和其他与西班牙语单词(同样的话,但翻译)
我已经设法通过XSL转换打印出两个XML文件,并将它们在彼此的侧面放置。
现在我的小问题。我使用的是按英文xml文件排序,以便字母按字母顺序排列。
现在我想西班牙的话,让你得到一个翻译的感觉打印出类似英语单词。
我只能改变xml文件中的位置,但我觉得自己在作弊。
这是我的英文xml文件。西班牙语与西班牙语单词相似。
<thesaurus>
<dictionary>
<language>Engelska</language>
<word type="1">Stroll</word>
<word type="2">Tender</word>
<word type="3">Agents</word>
<word type="4">Partial</word>
<word type="5">Pogotype</word>
<word type="6">Pretend</word>
<word type="7">Color</word>
<word type="8">Silent</word>
<word type="9">Foundations</word>
<word type="10">Grain</word>
</dictionary>
</thesaurus>
西班牙
</dictionary>
</thesaurus>
<word type="1">Paseando</word> <!-- Stroll-->
<word type="2">Tierno</word> <!--Tender -->
<word type="3">Agentes</word> <!--Agents -->
<word type="4">Parcial</word> <!--Partial -->
<word type="5">Logo</word> <!--Logotype -->
<word type="6">Pretender</word> <!-- Pretend-->
<word type="7">Color</word> <!--Color -->
<word type="8">Tímido</word> <!-- Silent-->
<word type="9">Dimientos</word> <!--Foundations -->
<word type="10">Grano</word> <!--Grain -->
</dictionary>
</thesaurus>
这就是我如何打印出
<xsl:apply-templates select="$doc1//*/*/word">
<xsl:sort order="ascending"/>
</xsl:apply-templates>
<xsl:apply-templates select="$doc2//*/*/word">
</xsl:apply-templates>
感谢
Felipe Otarola:这很容易做到,但是你忘了给我们看相应的西班牙字典。由于我们很少有人知道西班牙语,请编辑问题并提供西班牙语词典。我们必须知道哪个西班牙文单词是哪个英文单词的翻译 - 这个关系必须在字典中。请在提供西班牙字典后解释这一点。 – 2012-02-04 04:33:19
@DimitreNovatchev 只需添加西班牙语词典。 你的意思是说这些关系必须在字典中? 谢谢 – Dymond 2012-02-04 07:23:49
Felipe Otarola:我的意思是可以用来查找给定单词的其他语言对应物的东西。在你的情况下,这是'type'属性。而且你看到 - 只要你提供了西班牙字典的样本,这种关系就变得明显了,你马上就能得到解决方案。请学习如何提出一个好问题! – 2012-02-04 14:55:11