cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Seifert" <sseif...@pro-vision.de>
Subject AW: Specifying XSL sheet for client side translation in XSP?
Date Thu, 03 Jan 2002 13:03:27 GMT
I solved a similiar problem using a XSL stylesheet which only puts a
xml:stylesheet processing instructing in the resulting XML-Stream before
it is send to the browser.

Use a stylesheet like this (i called it "add_stylesheet_pi.xsl"):

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:param name="stylesheet"/>
<xsl:template match="*">
  <xsl:text disable-output-escaping="yes">&lt;?xml-stylesheet
type="text/xsl" href="</xsl:text><xsl:value-of
select="$stylesheet"/><xsl:text
disable-output-escaping="yes">"?&gt;</xsl:text>
  <xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>


And correct your Sitemap as follows:

   <map:match pattern="browsertest/">
    <map:generate src="reci-vba.xml"/>
    <map:select type="browser">
       <map:when test="explorer6">
          <map:transform src="stylesheets/add_stylesheet_pi.xsl">
            <map:parameter name="stylesheet"
value="stylesheets/reci2r.xsl"/>
          </map:transform>
          <map:serialize type="xml"/>
       </map:when>
       <map:otherwise>
          <map:transform src="stylesheets/reci2r.xsl"/>
          <map:serialize type="html"/>
       </map:otherwise>
    </map:select>
   </map:match>


Stefan

> -----Urspr√ľngliche Nachricht-----
> Von: Rune Sandnes [mailto:rune@klapp.no]
> Gesendet: Freitag, 28. Dezember 2001 15:44
> An: cocoon-users@xml.apache.org
> Betreff: Specifying XSL sheet for client side translation in XSP?
> 
> 
> 
> I have gotten the browser-detection features to work with Cocoon 2, I
> plan to serve
> raw XML and XSL to users of Explorer 6, so they can do the
> XSL-transformation client-side,
> Cocoon will do the transformation for other browsers.
> 
> My sitemap looks like this, and it works nicely for static files:
> 
>    <map:match pattern="browsertest/">
>     <map:generate src="reci-vba.xml"/>
>     <map:select type="browser">
>        <map:when test="explorer6">
>           <map:serialize type="xml"/>
>        </map:when>
>        <map:otherwise>
>           <map:transform src="stylesheets/reci2r.xsl"/>
>           <map:serialize type="html"/>
>        </map:otherwise>
>     </map:select>
>    </map:match>
> 
> (The string "explorer6" is defined further up in the sitemap, with
>     <browser name="explorer6" useragent="MSIE 6"/>
> i the <map:selector bane="browser"> section)
> 
> The start of the XML file in question looks like this:
> 
>   <?xml version="1.0" ?>
>   <?xml:stylesheet type="text/xsl" href="/stylesheets/reci2r.xsl" ?>
> 
> The <?xml:stylesheet> part is ignored when Cocoon does the
> transformation, the
> transform specified in the sitemap takes preference.
> 
> My problem is that I don't want to serve static XML files, 
> but generated
> content
> through XSP. When I try to do this operation with a generated 
> XSP file I
> can't 
> seem to get the <?xml:stylesheet> instruction through to the 
> client. It
> just 
> disappears, no matter where in the XSP file I put it.
> 
> Anyone know how to do this?
> 
> 
> Thanks,
> Rune,
> Klapp Media,
> Trondheim, Norway
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> 
> 
> 
> 
> 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message