You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2003/11/14 16:45:31 UTC
cvs commit: cocoon-2.1/src/webapp/samples/text-wrap/xslt docnbsp.xsl
sylvain 2003/11/14 07:45:31
Modified: src/webapp/samples/text-wrap sitemap.xmap welcome.html
Added: src/webapp/samples/text-wrap/xslt docnbsp.xsl
Log:
Another attempt: keep indentation by replacing sequences of two consecutive spaces by a nbsp and a space
Revision Changes Path
1.2 +7 -1 cocoon-2.1/src/webapp/samples/text-wrap/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/text-wrap/sitemap.xmap,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sitemap.xmap 8 Nov 2003 07:59:39 -0000 1.1
+++ sitemap.xmap 14 Nov 2003 15:45:31 -0000 1.2
@@ -38,6 +38,12 @@
<map:serialize type="html"/>
</map:match>
+ <map:match pattern="nbsp/*">
+ <map:generate src="data/{1}.xml"/>
+ <map:transform src="xslt/docnbsp.xsl"/>
+ <map:serialize type="html"/>
+ </map:match>
+
</map:pipeline>
</map:pipelines>
1.7 +23 -0 cocoon-2.1/src/webapp/samples/text-wrap/welcome.html
Index: welcome.html
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/text-wrap/welcome.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- welcome.html 9 Nov 2003 03:40:44 -0000 1.6
+++ welcome.html 14 Nov 2003 15:45:31 -0000 1.7
@@ -106,6 +106,29 @@
</li>
</ul>
+<h2>Using the "docnbsp.xsl" stylesheet</h2>
+<p>Sequences of two consecutive spaces are replaced by a non-nonbreaking space and a regular space.
+
+</p>
+<ul>
+<li>
+<a href="nbsp/with-word-boundaries">Long Line With Word Boundaries</a>
+</li>
+<li>
+<a href="nbsp/without-word-boundaries">Long Line Without Word Boundaries</a>
+</li>
+<li>
+<a href="nbsp/cdata-model">CDATA and deeply embedded xml content model</a>
+</li>
+<li>
+<a href="nbsp/cdata-model-2">CDATA and deeply embedded xml content model with long names</a>
+</li>
+<li>
+<a href="nbsp/ascii-art">Ascii Art</a>
+</li>
+</ul>
+
+
<a name="notes" />
<h2>Other notes</h2>
<p>
1.1 cocoon-2.1/src/webapp/samples/text-wrap/xslt/docnbsp.xsl
Index: docnbsp.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings"
extension-element-prefixes="str">
<!-- doc.xsl - text line wrapping
This stylesheet does not do any line wrapping.
-->
<xsl:template match="document">
<html>
<head>
<title><xsl:value-of select="header/title"/></title>
</head>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="body">
<body>
<h1><xsl:value-of select="header/title"/></h1>
<p>Comment from stylesheet: No special handling was done for the
<source> elements. Note the long right-left scrollbar.
</p>
<xsl:apply-templates/>
</body>
</xsl:template>
<xsl:template match="section">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="source">
<div style="padding:4pt; margin-bottom:8pt; border-width:1px; border-style:solid; border-color:#0086b2;">
<!-- iterate over each line -->
<xsl:for-each select="str:split(string(.), ' ')">
<code>
<!-- replace each group of two spaces by a and a space to allow line wrap while still
keeping indentation -->
<xsl:for-each select="str:split(string(.), ' ')">
<xsl:value-of select="."/><xsl:text>  </xsl:text>
</xsl:for-each>
</code>
<br/>
</xsl:for-each>
</div>
</xsl:template>
<xsl:template match="title">
<h2><xsl:apply-templates/></h2>
</xsl:template>
<xsl:template match="p">
<p><xsl:apply-templates/></p>
</xsl:template>
</xsl:stylesheet>