cancel
Showing results for 
Search instead for 
Did you mean: 

web forms: xsl indenting

sbzoom
Champ in-the-making
Champ in-the-making
This is a small thing that is bugging me, but it is bugging me nonetheless.  There is an attribute you can add to a web form that makes the resulting HTML have all the indentation you had used in your XSL template.


  <xsl:output method="xml" encoding="UTF-8" indent="yes"
      omit-xml-declaration="no"
      doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

See the indent="yes".  Doesn't do anything.  Resulting HTML is all flat against the left side.  Is there anything I can do to change this?

Thanks.

Charlie
1 REPLY 1

sbzoom
Champ in-the-making
Champ in-the-making
Figured it out myself.  After digging through the code I was able to figure out that Alfresco is using Xalan as a transformer.  Because of that, I can add Xalan specific tags to my transformations - and they have an indent.


<xsl:stylesheet version="1.0"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xalan="http://xml.apache.org/xalan"            // Just add this
    exclude-result-prefixes="xhtml">
  <xsl:output method="xml" encoding="UTF-8"
      indent="yes"                                       // This does nothing
      xalan:indent-amount="4"                            // This is what works
      omit-xml-declaration="no"
      doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>
  <xsl:preserve-space elements="*"/>



</xsl:stylesheet>