Reputation: 15
I have the following 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>
<GetAllUserCollectionFromWebResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">
<GetAllUserCollectionFromWebResult>
<GetAllUserCollectionFromWeb>
<Users>
<User ID="Value" Sid="Value" Name="Value" LoginName="Value" Email="Value" Notes="" IsSiteAdmin="False" IsDomainGroup="False" Flags="0" />
<User ID="Value" Sid="Value" Name="Value" LoginName="Value" Email="Value" Notes="" IsSiteAdmin="True" IsDomainGroup="False" Flags="0" />
</Users>
</GetAllUserCollectionFromWeb>
</GetAllUserCollectionFromWebResult>
</GetAllUserCollectionFromWebResponse>
</soap:Body>
</soap:Envelope>
I've tried rendering the XML with XSL to output specific values; e.g. the LoginName.
This is my XSL;
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">
<xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="yes" />
<xsl:template match="/">
<xsl:for-each select="Envelope/soap:Body/GetAllUserCollectionFromWebResponse/GetAllUserCollectionFromWebResult/GetAllUserCollectionFromWeb/Users/User">
<xsl:value-of select="@LoginName" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Nothing is outputted, I simply want to output the LoginName attribute.
Please helps,
Many thanks
Upvotes: 1
Views: 854
Reputation: 32980
Two errors:
The soap namespace uri in your XSL misses the trailing /
.
<xsl:stylesheet ...
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
In your XPath for the user the location steps GetAllUserCollectionFromWebResponse
etc. need a namespace prefix mapped to URI http://schemas.microsoft.com/sharepoint/soap/directory/
<xsl:for-each xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/"
select="soap:Envelope/soap:Body/dir:GetAllUserCollectionFromWebResponse/dir:GetAllUserCollectionFromWebResult/dir:GetAllUserCollectionFromWeb/dir:Users/dir:User">
Upvotes: 1