You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/05/29 14:00:06 UTC

[WIKI-UPDATE] XInclude GETsnippets Thu May 29 14:00:06 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=XInclude , version: 6 on Thu May 29 11:07:13 2003 by JoergHeinicke

+ !The W3C specification
+ 
- The [introduction|http://www.w3.org/TR/xinclude/#intro] to the specification discusses it's relationship with other similar technologies such as XLink and XML entities.
?                                                                                          -

+ The [introduction|http://www.w3.org/TR/xinclude/#intro] to the specification discusses its relationship with other similar technologies such as XLink and XML entities.
- !Warning
+ !XInclude with Cocoon
- Cocoon's XInclude implementation does not support all features of the standard.
+ In Cocoon 2.1 you will find a completely refactored XInclude implementation, which is (almost?) standard conform, including [XPointer|http://www.w3.org/TR/xptr/].
- Here's what it does support: [XInclude Transformer|http://xml.apache.org/cocoon/userdocs/transformers/xinclude-transformer.html]
+ The Cocoon docu on XIncludeTransformer is a bit outdated, it refers still to the old implementation: [XInclude Transformer|http://cocoon.apache.org/2.1/userdocs/transformers/xinclude-transformer.html]
- Cocoon's [CInclude] implementation is Cocoon-specific but easier to use and more versatile.  It does however make your application non-portable.  (Meaning you must use Cocoon forever! ;-) )
+ If you don't like the usage of XPointer, you maybe want to have a look on Cocoon's [CInclude] implementation. Of course it is Cocoon-specific, but maybe easier to use and provides other functionality like [Caching] and POST requests. It does however make your application non-portable. (Meaning you must use Cocoon forever! ;-) )


Page: http://wiki.cocoondev.org/Wiki.jsp?page=GETsnippets , version: 6 on Thu May 29 11:31:41 2003 by 131.234.154.207

+ }}}
+ ''If your <body> element just contains text, the following templates will
+ transform it and escape any apostrophes present, replacing them with
+ &apos; character entities:
+ {{{
+ <xsl:template match="body">
+ 	<xsl:text>&lt;body&gt;</xsl:text>
+ 	<xsl:call-template name="escape-apos">
+ 		<xsl:with-param name="text" select="."/>
+ 	</xsl:call-template>
+ 	<xsl:text>&lt;/body&gt;</xsl:text>
+ </xsl:template>
+ 
+ <xsl:template name="escape-apos">
+ <xsl:param name="text"/>
+ <xsl:variable name="apos">'</xsl:variable>
+  <xsl:choose>
+   <xsl:when test="contains($text, $apos)">
+    <xsl:value-of select="substring-before($text, $apos)"/>
+    <xsl:text disable-output-escaping="yes">&amp;apos;</xsl:text>
+    <xsl:call-template name="escape-apos">
+     <xsl:with-param name="text" select="substring-after($text, $apos)"/>
+    </xsl:call-template>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="$text"/>
+  </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>