2016-04-05 9 views
1

私は以下のXMLを持っています。XSLTで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>

私は出力特定の値にXSLとXMLをレンダリングしようとしました。例えばLoginName。

これは私の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>

は何も私は単にLoginNameに属性を出力したい場合は、出力されません。助けてください

感謝

答えて

1

2つのエラー:あなたのXSLで

石鹸の名前空間URIは、末尾/をミス。ユーザーのためのあなたのXPathで

<xsl:stylesheet ... 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 

場所はGetAllUserCollectionFromWebResponseなどがこの作品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"> 
+0

にマッピングされた名前空間接頭辞を必要なステップ!どうもありがとうございました! –

関連する問題