Sample image2xhtml.xsl file for a custom "image" doctype

Note this will also allow you to edit the lenya meta data as lenya:meta is a child element of image. If you don't want the meta data to be editable with BXE, you'd have to wrap a new element around your non-meta data elements and change the bxe_path to select that instead.

<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:image="http://www.ngrm.org.uk/xmlns/image/1.0"
xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://www.w3.org/1999/xhtml"

exclude-result-prefixes="lenya image"
>

<xsl:param name="rendertype" select="''"/>
<xsl:param name="nodeid"/>

<xsl:template match="/image:image">
<xsl:choose>
<xsl:when test="$rendertype = 'edit'">
<div id="body">
<xsl:attribute name="bxe_xpath">/image:image</xsl:attribute>
<xsl:copy-of select="." />
</div>
</xsl:when>
<xsl:otherwise>
<div id="body">
<h1><xsl:value-of select="image:title" /></h1>
<p><xsl:value-of select="image:description" /></p>
<p><xsl:value-of select="image:attribution" /></p>
</div>
</xsl:otherwise>
</xsl:choose>

</xsl:template>

  • No labels