XMl新手-如何从另一个XMl返回特定元素?
从weather提要中,我得到了XSLT片段中的以下元素: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
<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"/>