Re: Initial review of xslt with no limits patch - Mailing list pgsql-hackers

From Mike Fowler
Subject Re: Initial review of xslt with no limits patch
Date
Msg-id 4C5B41B4.3020708@mlfowler.com
Whole thread Raw
In response to Re: Initial review of xslt with no limits patch  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Initial review of xslt with no limits patch  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Initial review of xslt with no limits patch  (Andrew Dunstan <andrew@dunslane.net>)
Re: Initial review of xslt with no limits patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi Pavel,

On 02/08/10 09:21, Pavel Stehule wrote:
> Hello
>
> 2010/8/2 Mike Fowler<mike@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:paramname="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-ofselect="$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:elementname="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


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Concurrent MERGE
Next
From: Tom Lane
Date:
Subject: Re: including backend ID in relpath of temp rels - updated patch