在我的XML文档中,每个潜在客户或乘客都有一个pickup
和dropoff
属性,该属性具有匹配的waypoint
id。基于属性值的访问节点
<r:rides>
<r:ride>
<r:lead pickup="1" dropoff="2">
</r:lead>
<r:passengers>
<r:passenger pickup="1" dropoff="3">
</r:passenger>
</r:passengers>
<r:waypoints>
<r:waypoint id="1">
<a:place>Hall</a:place>
</r:waypoint>
<r:waypoint id="2">
<a:place>Apartments</a:place>
</r:waypoint>
<r:waypoint id="3">
<a:place>Train Station</a:place>
</r:waypoint>
</r:waypoints>
</r:ride>
</r:rides>
如何为XSL中的每位潜在客户或乘客选择a:place
?例如:
<xsl:for-each select="r:lead">
Route: <pickup goes here/> → <dropoff goes here/>
</xsl:for-each>
预期成果:
路线:霍尔→公寓
<xsl:for-each select="r:passengers/r:passenger">
Route: <pickup goes here/> → <dropoff goes here/>
</xsl:for-each>
预期成果:
路线:霍尔→火车站
请勿将XML与未绑定的前缀一起发布。删除前缀或包含名称空间声明。 –
你是什么意思?你的意思是'xmlns:r =“http://www.rideshare.com/ride”' – methuselah
是的,这就是我的意思。 –