Xml 如何从XSL创建模式弹出消息
我正在创建一个XSL页面,我想在其中调用一个模式弹出窗口。 以下是我的XSL文件的一部分:Xml 如何从XSL创建模式弹出消息,xml,xslt,Xml,Xslt,我正在创建一个XSL页面,我想在其中调用一个模式弹出窗口。 以下是我的XSL文件的一部分: <xsl:if test="(/ShoppingBag/Multibuy/Discount) > 0"> <tr> <td class="sbTotalsColLeft saving"> DiscountDetails </td> <td cl
<xsl:if test="(/ShoppingBag/Multibuy/Discount) > 0">
<tr>
<td class="sbTotalsColLeft saving">
DiscountDetails
</td>
<td class="sbTotalsColRight">
</td>
</tr>
</xsl:if>
我想做的是,当客户端点击折扣详细信息时,我想显示一个带有以下信息的模式弹出窗口
<table class="tbpromotionTypes">
<xsl:for-each select="/ShoppingBag/MultibuyDiscountedPromotionTypes/PromotionType">
<tr>
<td class="ptLeft ">
<xsl:value-of select ="./PromotionHeading"/>
</td>
<td class="ptRight">
<xsl:value-of select="./DiscountedPrice"/>
</td>
</tr>
</xsl:for-each>
</table>
XSLT没有弹出窗口或单击的概念 您可以使用xsl:message将文本记录到控制台 您可以根据需要将XML转换为HTML,包括JavaScript,以创建一个页面,其中模式对话框和单击是可操作的概念 对于此输入示例文件: 此XSLT脚本: 生成此HTML文件: 这样,当您按要求单击折扣详细信息时,将显示一个模式对话框 建议:使用td类sbTotalsColLeft或使用JQuery保存以显示模型弹出窗口
$(".sbTotalsColLeft").Click(...... modal popup code here ....);
请参阅:Madurika Welivita-也许您应该提供更多详细信息。例如,解释XSL呈现xml、文本或HTML,它们的呈现输出为1。调用jquery库2,xsl将需要输出一个jquery方法,该方法将在单击时创建一个弹出窗口。\@PhilVallone,你说得对,我在回答中也这么做了。您好,谢谢您提供的详细信息。非常感谢,但是code.jquery.com/jquery-1.9.1.js>code.jquery.com/ui/1.10.3/jquery ui.js>是指向网站第三部分的,我可以下载这个.js文件并附加到我的脚本文件夹吗?我可以在哪里下载这些文件您可以在URL指定的位置下载引用文件:对于jquery-1.9.1.js,它是,依此类推。“也请看,也请看。”拉什德,如果你对这个答案感到满意,请投/。谢谢。@kjhughes:我正在处理同一个问题,我尝试了你的代码,但我得到的只是折扣细节,但当我点击它时,什么也没发生,我在折扣细节下面的同一页上看到了面包、鸡蛋和牛奶。有什么想法吗?@ank:看。
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#dialog" ).dialog({autoopen: false});
$( "#dialog" ).dialog("close");
});
$(document).ready(function() {
$('#discountDetailsId').click(function() {
$( "#dialog" ).dialog({ modal: true });
});
});
</script>
</head>
<body>
<table>
<tr>
<td id="discountDetailsId">DiscountDetails</td>
</tr>
</table>
<div id="dialog" title="Discount Details">
<table class="tbpromotionTypes">
<xsl:for-each select="/ShoppingBag/MultibuyDiscountedPromotionTypes/PromotionType">
<tr>
<td class="ptLeft ">
<xsl:value-of select ="./PromotionHeading"/>
</td>
<td class="ptRight">
<xsl:value-of select="./DiscountedPrice"/>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"><script src="http://code.jquery.com/jquery-1.9.1.js"></script><script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script><link rel="stylesheet" href="/resources/demos/style.css"><script>
$(function() {
$( "#dialog" ).dialog({autoopen: false});
$( "#dialog" ).dialog("close");
});
$(document).ready(function() {
$('#discountDetailsId').click(function() {
$( "#dialog" ).dialog({ modal: true });
});
});
</script></head>
<body>
<table>
<tr>
<td id="discountDetailsId">DiscountDetails</td>
</tr>
</table>
<div id="dialog" title="Discount Details">
<table class="tbpromotionTypes">
<tr>
<td class="ptLeft ">Bread</td>
<td class="ptRight">$1</td>
</tr>
<tr>
<td class="ptLeft ">Eggs</td>
<td class="ptRight">$2</td>
</tr>
<tr>
<td class="ptLeft ">Milk</td>
<td class="ptRight">$2</td>
</tr>
</table>
</div>
</body>
</html>
$(".sbTotalsColLeft").Click(...... modal popup code here ....);