BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XSLT
Find all xsl:variables that are in scope?
Binary Search in XSLT
Get the newest 5 articles out of hundreds -- a super efficient sort in XSLT
Dynamically change the encoding of your XSLT stylesheet
Identifying an attribute or a namespace node
Build a XPath expression for a node
Avoiding an XSLT Processor crash due to deep recursive processing
Conditional generation of a string in a single XPath expression
Re: Re: ABS function implemented as a single XPath expression
Re: ABS function implemented as a single XPath expression
ABS function implemented as a single XPath expression
XML to HTML text editor
Dynamically Selecting Which Element To Sort On Using Parameters
Avoid NaN in XPath sum() function
JScript Super Class To Handle XML Transformations
Test if a bit is on
Web Methodology (Layout Management)
Grouping an XML Node by First Letter
Dependent ComboBox in HTML build with XSLT
Re: How to use XSL function sum() to sum 2 XML fields


 
 

<< XQuery.NET and XML >>


By Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First Posted 03/05/2001
Times viewed 430

Format XML/XSL for Documentation


Summary Use these Templates to format xml for documentation.

These Temlates are easy to use.

<xsl:call-template name=formatxml>
     <xsl:with-param name=selnode select=./>
</xsl:call-template>

The only required Parameter is selnode whichis the node you wish to select.

Here is an alternate version with all the params except indent.

<xsl:call-template name=formatxml>

  <xsl:with-param name=selnode/>
  <xsl:with-param name=template-style>font:small 'Verdana';</xsl:with-param>
  <xsl:with-param name=punctuation-style>color:blue;</xsl:with-param>
  <xsl:with-param name=node-name-style>color:#990000;</xsl:with-param>
  <xsl:with-param name=comment-style>color:gray;</xsl:with-param>
  <xsl:with-param name=pi-style>color:green;</xsl:with-param>
  <xsl:with-param name=attr-value-style>color:black;</xsl:with-param>
  <xsl:with-param name=attr-name-style>color:red</xsl:with-param>

</xsl:call-template>

The indent Parameter needs to be changed in the template itself as it is recursive.

<xsl:for-each select=$selnode/node()>
    <xsl:call-template name=formatxml>
     <xsl:with-param name=selnode select=./>
     <xsl:with-param name=indent select=concat(number('2'),'em;')/>
    </xsl:call-template>
</xsl:for-each>

the number 2 is the value you will want to change. Em's will work better across platforms and screen resolutions.

Additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< XQuery.NET and XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML