Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XSLT更改页_Xslt_Hyperlink - Fatal编程技术网

XSLT更改页

XSLT更改页,xslt,hyperlink,Xslt,Hyperlink,我试图通过单击表中的一个元素,找出如何使用xslt转换更改页面。 我环顾四周,找不到答案,这是一个简单的代码,我想知道如何更改页面并显示一些内容: 我认为除了最后一个代码XSLT之外,您没有必要阅读代码。我已经添加了代码的其他部分,以防它们也需要一些更改 XSD: 所以我创造了两个元素,名字和年龄。名称由字符串名称和字符串描述组成。年龄只是一个积极的因素。现在我创建了XML文件,它只选择了两个不同的人: XML: 托马斯 他是个好人 10 彼得 他擅长游泳 12 我现在的转换是制作一个表

我试图通过单击表中的一个元素,找出如何使用xslt转换更改页面。 我环顾四周,找不到答案,这是一个简单的代码,我想知道如何更改页面并显示一些内容: 我认为除了最后一个代码XSLT之外,您没有必要阅读代码。我已经添加了代码的其他部分,以防它们也需要一些更改

XSD:


所以我创造了两个元素,名字和年龄。名称由字符串名称和字符串描述组成。年龄只是一个积极的因素。现在我创建了XML文件,它只选择了两个不同的人:

XML:


托马斯
他是个好人
10
彼得
他擅长游泳
12
我现在的转换是制作一个表,表中列出了各个年龄段的人的姓名:

XSLT:


名称
年龄
这就是我需要帮助的地方,我如何更改我所在的页面并进入一个只显示此人描述的页面,我想通过单击此人的姓名来实现这一点。我不想打开新窗口,只需更改页面即可

 </html>
 </xsl:template>
 </xsl:stylesheet>

在XSLT代码中,生成包含相关页面超链接的HTML。这可以是传统的超链接,也可以是具有onclick属性的任何元素

 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet type="text/xsl" href="try.xsl"?>
 <Table xmlns="http://www.w3schools.com"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.w3schools.com try.xsd">
 <Person>
 <Name>
 <theName>Thomas</theName>
 <Description>He is a nice guy</Description>
 </Name>
 <Age>10</Age>
 </Person>

 <Person>
 <Name>
 <theName>Peter</theName>
 <Description>He is good at swimming</Description>
 </Name>
 <Age>12</Age>
 </Person>

 </Table>
 <?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>

 <table border="2">
 <tr bgcolor="red">
 <th>Name</th>
 <th>Age</th>
 </tr>
 <xsl:for-each select="ws:Table/ws:Person">
 <tr>

 <td><xsl:value-of select="ws:Name/ws:theName"/></td>
 <td><xsl:value-of select="ws:Age"/></td>

 </tr>
 </xsl:for-each>
 </table>
 </html>
 </xsl:template>
 </xsl:stylesheet>