Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.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

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
XMl新手-如何从另一个XMl返回特定元素?_Xml_Xslt - Fatal编程技术网

XMl新手-如何从另一个XMl返回特定元素?

XMl新手-如何从另一个XMl返回特定元素?,xml,xslt,Xml,Xslt,从weather提要中,我得到了XSLT片段中的以下元素: <xsl:value-of select="data/current_condition/weatherCode"/> 那么,如何动态获取代码122的描述、图标等? <xsl:variable name="weather_desc" select="document('2.xml')/root"/> <xsl:variable name="weather_code" select="data/curre

从weather提要中,我得到了XSLT片段中的以下元素:

<xsl:value-of select="data/current_condition/weatherCode"/>
那么,如何动态获取代码122的描述、图标等?


<xsl:variable name="weather_desc" select="document('2.xml')/root"/>

<xsl:variable name="weather_code" select="data/current_condition/weatherCode"/>
<xsl:value-of select="$weather_desc/condition[code=$weather_code]/description"/>


所以您想要一个XSLT样式表处理两个XML文档,对吗?多使用一些第一个XML文档和XSLT会很有用,所以您希望一个XSLT样式表可以处理两个XML文档,对吗?有更多的第一个XML文档和XSLT来处理.Borodin会很有用-是的,我想要一个XSLT样式表来处理两个XML文档。Panda-34-非常感谢-回答得很好(我不得不删除“/root”,但这是一个完美的回答)。非常感谢。Borodin-是的,我想要一个XSLT样式表来处理两个XML文档。Panda-34-非常感谢-回答得很好(我不得不删除“/root”,但这是一个完美的回答)。非常感谢。
<xsl:variable name="weather_desc" select="document('2.xml')/root"/>

<xsl:variable name="weather_code" select="data/current_condition/weatherCode"/>
<xsl:value-of select="$weather_desc/condition[code=$weather_code]/description"/>