[xslt] ready to use extensions??



Hi,

are there any ready to use extensions for libxslt (i know that you 
cant link dynamically, so i mean ready to compile source code :-)

I would like to have an extension which can get imagewidth and 
imageheight of a referenced image, so i need filesystem access for 
this, which can only be done with an extension.

this way i could include height and width tag in to the resulting 
html tree.

its such a common task that somebody should already have written this 
for libxslt. i would like to do something like this (just typed, no 
real code):

<xsl:template match="img">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:if test="not(@width)">
      <xsl:attribute name="width" xmlns:is=...>
        <xsl:value-of select="is:imagewidth(@src)"/>
      </xsl:attribute>
    </xsl:if>
  </xsl:copy>
</xsl:template>

I had a similiar module in java for saxon, but it had a memory 
problem because it seems that this one loaded every image and didnt 
free the memory afterwards. so this one did only work with small 
documents and only with java.

there are many extensions in exslt but these are mostly document 
specific (node-set, regExp). i need often extension with access the 
system (like database access, filesystem access or date (like in 
exslt already implemented)

btw: i guess the extension handling is one of the drawbacks of 
libxslt[1]. in saxon you can call Java API from inside an XPATH 
Expression. So you can for example get the filesize of a referenced 
file and put this in the result tree like "Download now (500 KByte)"

regards,
janning

[1] as i guess daniel villard is reading this to i have to mention 
that this the only drawback i found :-) (ok. xslt 1.1 stuff would be 
nice like doing node-set() stuff automatically. saxon is quite cool 
in this way but too slow compared with libxslt.
 
-- 
Planwerk 6 /websolutions
Herzogstraße 86
40215 Düsseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]