Attachment 'whitespacesqueezer.xsl'

Download

   1 <?xml version="1.0" encoding="ISO-8859-1"?>
   2 
   3 <!--
   4     XML whitespace squeezer
   5 
   6     This squeezes out unnecessary whitespace.
   7 
   8     Copyright (c) 2006 Awarix, Inc. All rights reserved.
   9 
  10     Redistribution and use in source and binary forms, with or without
  11     modification, are permitted provided that the following conditions are met:
  12 
  13         * Redistributions of source code must retain the above copyright
  14           notice, this list of conditions and the following disclaimer.
  15         * Redistributions in binary form must reproduce the above copyright
  16           notice, this list of conditions and the following disclaimer in the
  17           documentation and/or other materials provided with the distribution.
  18         * Neither the name Awarix nor the names of its contributors may be used
  19           to endorse or promote products derived from this software without
  20           specific prior written permission.
  21 
  22     THIS SOFTWARE IS PROVIDED BY AWARIX AND CONTRIBUTORS ``AS IS'' AND ANY
  23     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25     DISCLAIMED. IN NO EVENT SHALL AWARIX AND CONTRIBUTORS BE LIABLE FOR ANY
  26     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32 
  33     $Id: whitespacesqueezer.xsl 11021 2006-10-20 01:41:34Z archie $
  34 -->
  35 
  36 <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  37 
  38     <xsl:output method="xml" encoding="UTF-8" indent="no" media-type="text/xml"/>
  39 
  40     <xsl:template match="*[@xml:space]">
  41         <xsl:copy>
  42             <xsl:apply-templates select="@*|node()" mode="copy"/>
  43         </xsl:copy>
  44     </xsl:template>
  45 
  46     <xsl:template match="text()[not(normalize-space(.))]"/>
  47 
  48     <xsl:template match="@*|node()">
  49         <xsl:copy>
  50             <xsl:apply-templates select="@*|node()"/>
  51         </xsl:copy>
  52     </xsl:template>
  53 
  54     <xsl:template match="@*|node()" mode="copy">
  55         <xsl:copy>
  56             <xsl:apply-templates select="@*|node()"/>
  57         </xsl:copy>
  58     </xsl:template>
  59 
  60 </xsl:transform>

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.