Getting all XML Key Value pairs in XSL

Getting all XML Key Value pairs in XSL

January 30th, 2009 // 2:13 am @ Amar

May times when I try to design a XSL against an unknown data stream, I would like to know what all values are available. Here is a nifty XSL which I have been using for a while. ( I am sure there are many versions out there ).

<xsl:for-each select="@*">
    <br/> Name: <xsl:value-of select="name()" /> Value:<xsl:value-of select="." />
</xsl:for-each>Â

It gives a list of all elements with their values. Quite handy to check if you have got the element name wrong etc.


Category : dotNet

Leave a Reply

Latest Posts

Testimonials

"Amar clearly has a thorough knowledge of Sharepoint, this knowledge, coupled with his professionalism and dedication made him a tremendous asset to the project. He was the key contributor to the later stages of the project delivery effort (the really difficult bit, long hours and hard work that puts huge demands on people), and I can state categorically that without his focussed dedication and hard work we would not have been able to meet the timescales imposed upon the project."

Tim Ellis , Sharepoint Project Manager , Royal Bank of Scotland

Subscribe Now