Quantcast
Channel: Development With A Dot
Viewing all articles
Browse latest Browse all 404

Show All Content in XSLT

$
0
0

I have already shown how you can display all attributes and their values from a XSLT content, but in case you want to look at the whole structure plus their attributes, you can use this instead:

   1:<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxsl="urn:schemas-microsoft-com:xslt"exclude-result-prefixes="msxsl asp"xmlns:asp="System.Web.UI.WebControls"xmlns:ddwrt2="urn:frontpage:internal">
   2:<xsl:outputmethod="html"/>
   3:<xsl:templatematch="*">
   4:<xsl:paramname="path"select="''"/>
   5:<xsl:variablename="previous"select="count(preceding-sibling::*[name()=name(current())])"/>
   6:<xsl:variablename="countprevious"select="count(following-sibling::*[name()=name(current())])"/>
   7:<xsl:variablename="fullpath"select="concat($path, '/', name(), substring(concat('[', $previous + 1, ']'), 1 div ($countprevious or $previous)))"/>
   8:<p><xsl:value-ofselect="$fullpath"/></p>
   9:<xsl:apply-templatesselect="@*|*">
  10:<xsl:with-paramname="path"select="$fullpath"/>
  11:</xsl:apply-templates>
  12:</xsl:template>
  13:<xsl:templatematch="@*">
  14:<xsl:paramname="path"select="''"/>
  15:<xsl:value-ofselect="concat($path, '/@', name())"/>: <xsl:value-ofselect="."/>
  16:<br/>
  17:</xsl:template>
  18:</xsl:stylesheet>

Viewing all articles
Browse latest Browse all 404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>