Re: Initial review of xslt with no limits patch

From: Mike Fowler <mike(at)mlfowler(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Initial review of xslt with no limits patch
Date: 2010-08-05 22:56:52
Message-ID: 4C5B41B4.3020708@mlfowler.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Pavel,

On 02/08/10 09:21, Pavel Stehule wrote:
> Hello
>
> 2010/8/2 Mike Fowler<mike(at)mlfowler(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-05 23:05:01 Re: including backend ID in relpath of temp rels - updated patch
Previous Message Josh Berkus 2010-08-05 22:49:05 Re: Concurrent MERGE