Imagine i have an .xml that looks like this:
<section>
<one>true</one>
<two>true</two>
<three>true</three>
<four>true</four>
<five>true</five>
</section>
I want to select the name of the element and its respective value in xslt. Note that the "actual section" has 100+ elements selecting every single one would be quite tedious, is there an easier/faster way? Thanks in advance.
路径/section/*
选择section
元素的所有子元素,根据 XSLT 版本(2.0 或 3.0),您可以简单地使用例如/section/*/concat(name(), ' : ', .)
来获得一系列name : value
或<xsl:value-of select="/section/*/concat(name(), ' : ', .)" separator=" "/>
输出所有或您可以使用模板或 for-each 处理/section/*
并在模板中输出例如<xsl:value-of select="concat(name(), ' : ', .)"/>
或 for-each for XSLT 1.0.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.