Xml 是否有类似<;xsl:url参数name=";“颜色”/>;?
如果我将此请求发送到页面:Xml 是否有类似<;xsl:url参数name=";“颜色”/>;?,xml,ajax,xslt,params,Xml,Ajax,Xslt,Params,如果我将此请求发送到页面: http://www.server.com/show.xml?color=red&number=two I like the color <xsl:url-param name="color" /> and the number <xsl:url-param name="number" />. 我可以这样做吗?: http://www.server.com/show.xml?color=red&number=two I l
http://www.server.com/show.xml?color=red&number=two
I like the color <xsl:url-param name="color" /> and the number <xsl:url-param name="number" />.
我可以这样做吗?:
http://www.server.com/show.xml?color=red&number=two
I like the color <xsl:url-param name="color" /> and the number <xsl:url-param name="number" />.
我喜欢这个颜色和数字。
如果你需要澄清这个问题,让我知道 谢谢你的回答
克雷拉德否;通常,XSL引擎不绑定到web服务器 然而,大多数XSL引擎允许您将一些参数与样式表和文档一起传递,因此,如果您是从支持web的系统调用它,您可以做的是将GET参数直接映射到XSL引擎 例如,如果您使用的是PHP,则可以执行以下操作:
<?php
$params = array(
'color' => $_GET['color'],
'number' => $_GET['number']
);
$xsl = new DOMDocument;
$xsl->load('mystylesheet.xsl');
$xml = new DOMDocument;
$xml->load('mydocument.xml');
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
foreach ($params as $key => $val)
$proc->setParameter('', $key, $val);
echo $proc->transformToXML($xml);
load('mydocument.xml');
$proc=新的XSLTProcessor;
$proc->importStyleSheet($xsl);//附加xsl规则
foreach($key=>$val的参数)
$proc->setParameter(“”,$key,$val);
echo$proc->transformToXML($xml);
你必须确保对你经过的任何东西进行消毒。然后,您可以简单地执行以下操作:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Remember to pick-up the parameters from the engine -->
<xsl:param name="color" />
<xsl:param name="number" />
<xsl:template match="*">
I like the color <xsl:value-of select="$color" />
and the number <xsl:value-of select="$number" />.
</xsl:template>
</xsl:stylesheet>
我喜欢这个颜色
还有电话号码。