File:  [Repository] / kupuMPIWG / apache-lenya / lenya / pageassets2kupulibrary.xsl
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Aug 30 17:10:22 2005 UTC (18 years, 9 months ago) by dwinter
Branches: first, MAIN
CVS tags: alpha, HEAD


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

<!--
  Transform lenya info assets about a pages resources
  to Kupu's library format.
  
  @version $Id: pageassets2kupulibrary.xsl,v 1.1.1.1 2005/08/30 17:10:22 dwinter Exp $
-->

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:li="http://apache.org/cocoon/lenya/info/1.0"
 >

<xsl:param name="iconUrl"/>
<xsl:param name="nodeid"/>

<xsl:template match="/">
  <collection>
    <uri>FIXME URI</uri>
    <icon></icon>
    <title>Page Image Library</title>
    <description>Images related to page or document.</description>
    <items>
      <xsl:apply-templates select="//li:asset"/>
    </items>
  </collection>
</xsl:template>

<xsl:template match="li:asset">
  <xsl:if test="(contains(dc:source, '.jpg') or contains(dc:source, '.gif') or contains(dc:source, '.png') or contains(dc:source, '.swf'))">
    <xsl:variable name="resource-url">
      <xsl:value-of select="concat(concat($nodeid, '/'), dc:source)"/>
    </xsl:variable> 
    
    <resource id="{$resource-url}">
      <title><xsl:value-of select="dc:source"/></title>
      <uri><xsl:value-of select="$resource-url"/></uri>
      <icon><xsl:value-of select="$iconUrl"/></icon>
      <description><xsl:value-of select="dc:title"/></description>
      <preview><xsl:value-of select="$resource-url"/></preview>
      <size><xsl:value-of select="dc:extent"/>&#160;kb</size>
    </resource>
  </xsl:if>
</xsl:template>

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template> 

</xsl:stylesheet>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>