You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/09/22 15:21:56 UTC

[DAISY] Updated: XSLT FAQs

A document has been updated:

http://cocoon.zones.apache.org/daisy/legacydocs/711.html

Document ID: 711
Branch: main
Language: default
Name: XSLT FAQs (unchanged)
Document Type: Document (unchanged)
Updated on: 9/22/05 1:21:34 PM
Updated by: Helma van der Linden

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 7405 bytes (previous version: 7425 bytes)
Content diff:
(8 equal lines skipped)
    <a href="http://cocoon.apache.org/community/mail-lists.html">other resources for
    XSLT,</a> specifically, the XSL FAQ and discussion lists.</p>
    
--- <p>The long answer is that you need to use the XSLT function</p>
+++ <p>The long answer is that you need to use the XSLT function
+++ <tt>normalize-space()</tt> whenever you want to rely on the content of an xml
+++ element.</p>
    
--- <pre>normalize-space()</pre>
--- 
--- <p>whenever you want to rely on the content of an xml element.</p>
--- 
    <p>For example, if your application is producing some Javascript code in your
    HTML output, then you might mistakenly try to use the following construct in
    your XSL stylesheet:</p>
    
--- <pre>alert('&lt;xsl:value-of select="message"/&gt;');</pre>
+++ <pre>alert('&lt;xsl:value-of select="message"/&gt;');
+++ </pre>
    
    <p>which will produce:</p>
    
(2 equal lines skipped)
    ');
    </pre>
    
--- <p>The line-endings in the content of your "message" element will cause
+++ <p>The line-endings in the content of your "<tt>message</tt>" element will cause
    javascript errors. Instead, do this:</p>
    
    <pre>alert('&lt;xsl:value-of select="normalize-space(message)"/&gt;');
(72 equal lines skipped)
          &lt;/xsl:element&gt;
      &lt;/xsl:template&gt;
    &lt;/xsl:stylesheet&gt;
--- 
    </pre>
    
    <p>Another approach is to extend your serializer component, described
--- <a href="faq-serializers.html#faq-4">here</a>.</p>
+++ <a href="daisy:710">here</a>.</p>
    
    <h2>What's "wrong" with use of the document() function in Cocoon?</h2>
    
(42 equal lines skipped)
    Xalan is inefficient. See:
    <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=4257">Issue 4257</a>
    and <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=28341">Issue
--- 28341</a>. Until this bug is fixed, consider using Saxon instead for document()
+++ 28341</a> Until this bug is fixed, consider using Saxon instead for document()
    function-related parsing needs.</p>
    
    <p>For other aggregation/inclusion approaches, please stay tuned for
(5 equal lines skipped)


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
no changes