[xml] shell function for XSLT



What do people think about the idea of adding a shell function to
libxml2's xpath? I'm thinking of something that would make this XSLT
possible:

<xsl:template match="date">
  <xsl:variable name="date-str">
      <xsl:value-of select="."/>
  </xsl:variable>
  <converted-date>
    <xsl:value-of select="shell('date --date=$date-str --rfc-2822')"/>
  </converted-date>
<xsl:template>

when invoked with the following:

 <date>12 January 2004</date>

this would output:

 <converted-date>Mon, 12 Jan 2004 00:00:00 +0000</converted-date>


There would have to be restrictions on the shell command used. 

$ would have to indicate XSLT parameters, not shell params.

quoting would have to be automatic (around xslt paramters for
example).

entitys would have to be resolved automatically.


I'd think about investigating implementation of this if anyone else
was interested.


Alternately does anyone have another way of achieving similar things?

 
-- 
Nic Ferrier
http://www.tapsellferrier.co.uk




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