活动和XSLT [英] Events and XSLT
问题描述
我已经编写了一个xml,xsd和xsl文件,我想知道如何执行以下操作:
I have written an xml, xsd and a xsl file, and I would like to know how to do the following:
如果用户点击某个链接,页面显示一个段落。如果用户点击不同的链接,页面将显示不同的段落。这怎么可能?谢谢。
If a user clicks on a certain link, the page displays a certain paragraph. If the user clicks on a different link, the page will display a different paragraph. How is this possible? Thank you.
编辑:
这是代码。这个想法是,如果我点击表中有问题的CountryName,我会显示有关该国家/地区的信息,如果我点击另一个,它会显示一个。信息将在ws:CountryName / ws:信息,将有文字和图片。
This is the code. The idea is, if I click on the CountryName in question in the table, I display information about that country, if I click another, it'll show that one. The information will be in ws:CountryName/ws:Information and there will be text and pictures.
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ws="http://www.w3schools.com"
version="1.0">
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr bgcolor="red"><th>Country</th></tr>
<xsl:for-each select="ws:Categorie/ws:Countries/ws:Country">
<tr><td><xsl:value-of select="ws:CountryName"/></td></tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
推荐答案
有XSLT的纯JS实现,也支持事件如 Saxon-CE 。可能想给他们一个尝试。实际上,他们自己的文档是使用它实现的,并且确实你想要实现什么,所以你可能想研究一下。
There are pure JS implementations of XSLT which also support events, like Saxon-CE. Might want to give them a try. Actually, their own documentation is implemented using it, and does exactly what you're trying to achieve, so you may want to study that.
这篇关于活动和XSLT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!