mardi 5 avril 2016

Render XML with XSLT

I have the following XML;

<soap:Envelope xmlns:soap="http://ift.tt/sVJIaE" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY">
  <soap:Body>
<GetAllUserCollectionFromWebResponse xmlns="http://ift.tt/vZCHiv">
  <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://ift.tt/tCZ8VR" version="1.0"
xmlns:soap="http://ift.tt/1bLnMDr">
<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




Aucun commentaire:

Enregistrer un commentaire