Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

svn commit: r532353 - in /lenya/trunk/src/modules/prettyprinting: ./ config: msg#00174

cms.lenya.cvs

Subject: svn commit: r532353 - in /lenya/trunk/src/modules/prettyprinting: ./ config/ config/module.xml xslt/ xslt/xml2nicexml.xsl

Author: nettings
Date: Wed Apr 25 06:53:24 2007
New Revision: 532353

URL: http://svn.apache.org/viewvc?view=rev&rev=532353
Log:
consolidated xml prettyprinting in new module. no functional changes.


Added:
lenya/trunk/src/modules/prettyprinting/
lenya/trunk/src/modules/prettyprinting/config/
lenya/trunk/src/modules/prettyprinting/config/module.xml (with props)
lenya/trunk/src/modules/prettyprinting/xslt/
lenya/trunk/src/modules/prettyprinting/xslt/xml2nicexml.xsl (with props)

Added: lenya/trunk/src/modules/prettyprinting/config/module.xml
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/prettyprinting/config/module.xml?view=auto&rev=532353
==============================================================================
--- lenya/trunk/src/modules/prettyprinting/config/module.xml (added)
+++ lenya/trunk/src/modules/prettyprinting/config/module.xml Wed Apr 25
06:53:24 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
+
+<module xmlns="http://apache.org/lenya/module/1.0";>
+ <id>org.apache.lenya.modules.prettyprinting</id>
+ <package>org.apache.lenya.modules</package>
+ <version>0.2</version>
+ <name>XML pretty-printing</name>
+ <lenya-version>@lenya.version@</lenya-version>
+ <description>This module contains an XML pretty printing stylesheet that
+ will behave correctly wrt whitespace in XHTML.</description>
+</module>

Propchange: lenya/trunk/src/modules/prettyprinting/config/module.xml
------------------------------------------------------------------------------
svn:eol-style = native

Added: lenya/trunk/src/modules/prettyprinting/xslt/xml2nicexml.xsl
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/prettyprinting/xslt/xml2nicexml.xsl?view=auto&rev=532353
==============================================================================
--- lenya/trunk/src/modules/prettyprinting/xslt/xml2nicexml.xsl (added)
+++ lenya/trunk/src/modules/prettyprinting/xslt/xml2nicexml.xsl Wed Apr 25
06:53:24 2007
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ xml prettyprinter for apache cocoon/lenya, contributed by
<nettings@xxxxxxxxxx>
+ everything that is non-trivial in this script has been borrowed from
somewhere.
+ this script is in the public domain.
+-->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+<xsl:output method="xml"/>
+
+<xsl:param name="indent-increment" select="' '" />
+
+ <!--
+ indentation
+ thanks to John Mongan, taken from
http://www.dpawson.co.uk/xsl/sect2/pretty.html
+ -->
+
+ <xsl:template match="*">
+ <xsl:param name="indent" select="'&#xA;'"/>
+
+ <xsl:value-of select="$indent"/>
+
+ <xsl:copy>
+ <xsl:copy-of select="@*" />
+ <xsl:apply-templates>
+ <xsl:with-param name="indent" select="concat($indent,
$indent-increment)"/>
+ </xsl:apply-templates>
+ <!-- add a trailing newline if the node has children and is not a mixed
content node -->
+ <xsl:if test="* and not(*[../text()[normalize-space(.) != '']])">
+ <xsl:value-of select="$indent"/>
+ </xsl:if>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="comment()|processing-instruction()">
+ <xsl:copy />
+ </xsl:template>
+
+ <!--
+ mixed content detection and handling
+ thanks to David Carlisle and Wendell Piez, taken from
http://www.dpawson.co.uk/xsl/sect2/normalise.html#d7206e52
+ -->
+ <xsl:template match="*[../text()[normalize-space(.) != '']]">
+ <!-- but this template matches any element appearing in mixed content -->
+ <xsl:variable name="textbefore"
+ select="preceding-sibling::node()[1][self::text()]"/>
+ <xsl:variable name="textafter"
+ select="following-sibling::node()[1][self::text()]"/>
+ <!-- Either of the preceding variables will be an empty node set
+ if the neighbor node is not text(), right? -->
+ <xsl:variable name="prevchar"
+ select="substring($textbefore, string-length($textbefore))"/>
+ <xsl:variable name="nextchar"
+ select="substring($textafter, 1, 1)"/>
+
+ <!-- Now the action: -->
+ <xsl:if test="$prevchar != normalize-space($prevchar)">
+ <!-- If the original text had a space before, add one back -->
+ <xsl:text> </xsl:text>
+ </xsl:if>
+
+ <xsl:copy>
+ <!-- Copy the element over -->
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+
+ <xsl:if test="$nextchar != normalize-space($nextchar)">
+ <!-- If the original text had a space after, add one back -->
+ <xsl:text> </xsl:text>
+ </xsl:if>
+
+ </xsl:template>
+
+<!--
+ normalize all whitespace in text nodes (i.e. those that don't get matched by
the mixed content handler)
+-->
+ <xsl:template match="text()">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:template>
+
+</xsl:stylesheet>

Propchange: lenya/trunk/src/modules/prettyprinting/xslt/xml2nicexml.xsl
------------------------------------------------------------------------------
svn:eol-style = native


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation