从XML(XSLT)获取第二个值
我有下面的XML,我只想要第二个值。。。 我该怎么做 XML:从XML(XSLT)获取第二个值,xml,xslt,transform,Xml,Xslt,Transform,我有下面的XML,我只想要第二个值。。。 我该怎么做 XML: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetVer
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetVersionCollectionResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<GetVersionCollectionResult>
<Versions>
<Version AssignedTo="value" />
<Version AssignedTo="This value I want to get" />
<Version AssignedTo="value" />
<Version AssignedTo="value" />
</Versions>
</GetVersionCollectionResult>
</GetVersionCollectionResponse>
</soap:Body>
</soap:Envelope>
获取每个值的XML请求
(如何更改此值以仅获取第二个值?)
提前感谢你的帮助
问候,,
Simon您还必须在样式表中找到XML文档中使用的
样式表
您使用哪种语言?我使用的语言是XSLTTry以使用此参数match=“value[2]”我将此行“”更改为“”,但随后没有返回任何结果。。。结果是空白的…嗨,埃罗,非常感谢。它起作用了!你知道一个好的网站/调试器来测试这些东西吗?
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="no"></xsl:output>
<xsl:template name="ShowVariables" match="/" >
<xsl:for-each select="//*[name()='Version']">
<xsl:value-of select="@AssignedTo" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sharepoint="http://schemas.microsoft.com/sharepoint/soap/">
<xsl:output method="text" indent="no"/>
<xsl:template match="/">
<xsl:value-of select="//sharepoint:Version[2]/@AssignedTo"/>
</xsl:template>
</xsl:stylesheet>
<xsl:value-of select="soap:Envelope/soap:Body/sharepoint:GetVersionCollectionResponse/sharepoint:GetVersionCollectionResult/sharepoint:Versions/sharepoint:Version[2]/@AssignedTo"/>
This value I want to get