Hi Pavel,

On 02/08/10 09:21, Pavel Stehule wrote:
Hello

2010/8/2 Mike Fowler<m...@mlfowler.com>:
Hi Pavel,

Currently your patch isn't applying to head, from the looks of things a
function signature has changed. Can you update your patch please?


yes - see attachment


Thanks, the new patch applies cleanly. However I've been attempting to run the parameterised XSLT this evening but to no avail. Reverting your code I've discovered that it does not work in the old version either.

Given the complete lack of documentation (not your fault) it's always possible that I'm doing something wrong. Given the query below, you should get the XML that follows, and indeed in oXygen (a standalone XML tool) you do:

SELECT xslt_process('<employee><name>cim</name><age>30</age><pay>400</pay></employee>'::text, $$<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
   <xsl:strip-space elements="*"/>
   <xsl:param name="n1"/>
   <xsl:param name="n2"/>
   <xsl:param name="n3"/>
   <xsl:param name="n4"/>
   <xsl:param name="n5" select="'me'"/>
   <xsl:template match="*">
     <xsl:element name="samples">
       <xsl:element name="sample">
         <xsl:value-of select="$n1"/>
       </xsl:element>
       <xsl:element name="sample">
         <xsl:value-of select="$n2"/>
       </xsl:element>
       <xsl:element name="sample">
         <xsl:value-of select="$n3"/>
       </xsl:element>
       <xsl:element name="sample">
         <xsl:value-of select="$n4"/>
       </xsl:element>
       <xsl:element name="sample">
         <xsl:value-of select="$n5"/>
       </xsl:element>
     </xsl:element>
   </xsl:template>
</xsl:stylesheet>$$::text, 'n1=v1,n2=v2,n3=v3,n4=v4,n5=v5'::text)

<samples>
  <sample>v1</sample>
  <sample>v2</sample>
  <sample>v3</sample>
  <sample>v4</sample>
  <sample>v5</sample>
</samples>

Sadly I get the following in both versions:

<samples>
  <sample/>
  <sample/>
  <sample/>
  <sample/>
  <sample/>
</samples>


Unless you can see anything I'm doing wrong I suggest we mark this patch either 'Returned with feedback' or 'Rejected'. Since contrib/xml2 is deprecated, perhaps a better way forward is to pull XSLT handling into core and fix both the apparent inability to handle parameters as well as the limited number of parameters.

Regards,

--
Mike Fowler
Registered Linux user: 379787

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to