Re: [xml] shell function for XSLT



A couple of possible alternatives:
1) Implement the exslt routines parse-date and format-date for libexslt.
2) Implement the exslt routine parse-date and use Jeni Tennison's exslt:function
version of format-date.
3) Parse the date-str variable into xs:date format and then use Jeni Tennison's
format-date function.

I think implementing a shell function would not only be dangerous but difficult
to maintain under the various operating systems supported by libxslt.

Charlie B

Quoting Nic Ferrier <nferrier tapsellferrier co uk>:

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

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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