[Product-Developers] Xdv/Diazo: generating text from a xsl:function

Noe Misael Nieto Arroyo noe at iservices.com.mx
Fri Feb 11 19:34:07 UTC 2011


I'm trying to create a xsl:function that outputs the value of a xpath
selector sorrounded with some boilerplate code (html <div/> elements). Upon
calling the function, the content of the xpath selector makes it to the html
output, but not the boilerplate code.

Here's the xml stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<rules
    xmlns="http://namespaces.plone.org/xdv"
    xmlns:css="http://namespaces.plone.org/xdv+css"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:iservices="http://namespaces.iservices.mx/"
    >

    <!--Declare function that outputs wrapping divs for portlet layouts-->
    <xsl:function name="iservices:as_portlet_layout" as="xs:string">
        <xsl:param name="selector"/>
        <div class="boilerplate_1">
          <div clas="boilerplate_2">
            <xsl:copy-of select="$selector"/>
          </div>
        </div>
    </xsl:function>

    <xsl:value-of
select="iservices:as_portlet_layout(/some/expath/selector)"/>

</rules>

The Value of /some/expath/selector makes it to the rendered html on the
browser, but not the rest of the boilerplate code. I also tryied to use
xsl:text, but with the same results:

    <xsl:function name="iservices:as_portlet_layout" as="xs:string">
        <xsl:param name="selector"/>
        <xsl:text><![CDATA[<div class="boilerplate_1">]]></xsl:text>
        <xsl:text><![CDATA[  <div clas="boilerplate_2">]]></xsl:text>
            <xsl:copy-of select="$selector"/>
        <xsl:text><![CDATA[  </div>]]></xsl:text>
        <xsl:text><![CDATA[</div>]]></xsl:text>
    </xsl:function>

Using xdv 0.4b3 on Plone4. What am I doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20110211/0dbf0d70/attachment-0002.html>


More information about the Product-Developers mailing list