Sha256: 05c5e0eb9d9370e253938a401afa1ee10fb8f204fa013cc1f5a3967fde8db367

Contents?: true

Size: 1.48 KB

Versions: 25

Compression:

Stored size: 1.48 KB

Contents

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="ISO-8859-1"/>
  <xsl:param name="indent-increment" select="'   '"/>
  
  <xsl:template name="newline">
    <xsl:text disable-output-escaping="yes">
</xsl:text>
  </xsl:template>
  
  <xsl:template match="comment() | processing-instruction()">
    <xsl:param name="indent" select="''"/>
    <xsl:call-template name="newline"/>    
    <xsl:value-of select="$indent"/>
    <xsl:copy />
  </xsl:template>
  
  <xsl:template match="text()">
    <xsl:param name="indent" select="''"/>
    <xsl:call-template name="newline"/>    
    <xsl:value-of select="$indent"/>
    <xsl:value-of select="normalize-space(.)"/>
  </xsl:template>
    
  <xsl:template match="text()[normalize-space(.)='']"/>
  
  <xsl:template match="*">
    <xsl:param name="indent" select="''"/>
    <xsl:call-template name="newline"/>    
    <xsl:value-of select="$indent"/>
      <xsl:choose>
       <xsl:when test="count(child::*) > 0">
        <xsl:copy>
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates select="*|text()">
           <xsl:with-param name="indent" select="concat ($indent, $indent-increment)"/>
         </xsl:apply-templates>
         <xsl:call-template name="newline"/>
         <xsl:value-of select="$indent"/>
        </xsl:copy>
       </xsl:when>       
       <xsl:otherwise>
        <xsl:copy-of select="."/>
       </xsl:otherwise>
     </xsl:choose>
  </xsl:template>    
</xsl:stylesheet>

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
wdd-ruby-ext-0.6.3 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.6.2 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.6.0 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.5.1 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.5.0 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.4.4 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.4.3 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.4.2 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wdd-ruby-ext-0.4.1 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wordnik-0.4.6 config/pretty_print.xsl
wordnik-0.4.5 config/pretty_print.xsl
wordnik-0.4.4 config/pretty_print.xsl
wordnik-0.4.3 config/pretty_print.xsl
wordnik-0.4.2 config/pretty_print.xsl
wordnik-0.4.1 config/pretty_print.xsl
wdd-ruby-ext-0.4.0 lib/wdd-ruby-ext/resources/pretty_xml.xsl
wordnik-0.4.0 config/pretty_print.xsl
wordnik-0.3.9 config/pretty_print.xsl
wordnik-0.3.8 config/pretty_print.xsl
wordnik-0.3.7 config/pretty_print.xsl