Asp.net 在以下场景中生成XSLT
我从后端服务器得到以下响应,将数据显示为搜索结果页面右侧的快速链接Asp.net 在以下场景中生成XSLT,asp.net,xml,xslt,xslt-2.0,xslt-1.0,Asp.net,Xml,Xslt,Xslt 2.0,Xslt 1.0,我从后端服务器得到以下响应,将数据显示为搜索结果页面右侧的快速链接 <NavigatorItems> <Navigator Name="Shoes"> <Name>Nike</Name> <WebSite>www.nike.com</WebSite> <Name>Reebok</Name> <WebSite>www.reebok.com</WebSite
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
我在这方面哪里出了问题?我试图修改XSLT并进行了检查,但没有成功
请建议。此转换:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
应用于提供的XML文档时:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
耐克
www.nike.com
南非短角羚
www.reebok.com
阿迪达斯
www.adidas.com
www.mysite.com/showallshoes
李牛仔裤
www.lee.com
利维斯
www.levi.com
执法人员
www.lawman.com
www.mysite.com/showallcoots
生成所需的正确结果:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
鞋
-
-
-
衣裳
-
-
-
浏览器显示如下所示:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
鞋
这一转变:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
应用于提供的XML文档时:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
耐克
www.nike.com
南非短角羚
www.reebok.com
阿迪达斯
www.adidas.com
www.mysite.com/showallshoes
李牛仔裤
www.lee.com
利维斯
www.levi.com
执法人员
www.lawman.com
www.mysite.com/showallcoots
生成所需的正确结果:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
鞋
-
-
-
衣裳
-
-
-
浏览器显示如下所示:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Navigator">
<p><xsl:value-of select="@Name"/></p>
<ul>
<xsl:apply-templates select="Name"/>
</ul>
<xsl:apply-templates select="ShowAll"/>
</xsl:template>
<xsl:template match="Name">
<li>
<a href="http://{following-sibling::WebSite[1]}">
<xsl:value-of select="."/>
</a>
</li>
</xsl:template>
<xsl:template match="ShowAll">
<p>
<a href="http://{.}">
<xsl:text>View More Results</xsl:text>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
<NavigatorItems>
<Navigator Name="Shoes">
<Name>Nike</Name>
<WebSite>www.nike.com</WebSite>
<Name>Reebok</Name>
<WebSite>www.reebok.com</WebSite>
<Name>Adidas</Name>
<WebSite>www.adidas.com</WebSite>
<ShowAll>www.mysite.com/showallshoes</ShowAll>
</Navigator>
<Navigator Name="Clothes">
<Name>Lee Jeans</Name>
<WebSite>www.lee.com</WebSite>
<Name>Levis</Name>
<WebSite>www.levi.com</WebSite>
<Name>Lawman</Name>
<WebSite>www.lawman.com</WebSite>
<ShowAll>www.mysite.com/showallclothes</ShowAll>
</Navigator>
</NavigatorItems>
<p>Shoes</p>
<ul>
<li>
<a href="http://www.nike.com">Nike</a>
</li>
<li>
<a href="http://www.reebok.com">Reebok</a>
</li>
<li>
<a href="http://www.adidas.com">Adidas</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallshoes">View More Results</a>
</p>
<p>Clothes</p>
<ul>
<li>
<a href="http://www.lee.com">Lee Jeans</a>
</li>
<li>
<a href="http://www.levi.com">Levis</a>
</li>
<li>
<a href="http://www.lawman.com">Lawman</a>
</li>
</ul>
<p>
<a href="http://www.mysite.com/showallclothes">View More Results</a>
</p>
鞋
A一些答案,迪米特。。!!!谢谢。。!!!!你能给我提供一些在线资源/网站来更详细地学习XSLT吗。我是初学者。谢谢你的帮助。“再次谢谢你。”他说,不客气。在回答一个问题时,我提供了我认为这方面最好的资源:Dimitre:我还有一个标签,就在我的每个标签下面。此标记包含“真”或“假”。在分配任务时,我需要确定这一点。因此,如果这是真的,我将写为:@Sayed:最好你问一个新问题。现在我正在工作,稍后将能够看到你的新问题。A一些答案Dimitre。。!!!谢谢。。!!!!你能给我提供一些在线资源/网站来更详细地学习XSLT吗。我是初学者。谢谢你的帮助。“再次谢谢你。”他说,不客气。在回答一个问题时,我提供了我认为这方面最好的资源:Dimitre:我还有一个标签,就在我的每个标签下面。此标记包含“真”或“假”。在分配任务时,我需要确定这一点。因此,如果这是真的,我将写为:@Sayed:最好你问一个新问题。现在我正在工作,稍后将能够看到你的新问题。