Xquery and XSLT

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Xquery and XSLT

Pietro Liuzzo
Hi,

I would like to use some xslt in my app in exist 2.2. I have in this some named templates with parameters which have values set from variables within the xslt library.

in the xslt, example.xslt I have: 

.....

<xsl:variable name="singletoncount">

... a lot of stuff here...

</xsl:variable>

<xsl:call-template name="leafs">
           <xsl:with-param name="singletons">

<xsl:value-of select="string-length($singletoncount)"/>

</xsl:with-param>

</xsl:call-template>

....

 <xsl:template name="leafs">

        <xsl:param name="singletons"/>

 <xsl:variable name="position" select="$count + $singletons"/>

...

</xsl:template>


in my xquery

transform:transform(
       
$document,
       
'xmldb:exist:///db/apps/myapp/xslt/example.xsl'
       
,
 
<parameters>
   
<param name="singletons" value="."/>
</parameters>

    )


I get an error if I don't set the parameter value (<param name="singletons"/>) but if I leave it empty or simply don't add the parameter in the xquery the transformation obviously does not work. 

How shall I do this?

Thanks a lot!
Pietro

--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Xquery and XSLT

Alister Pillow-3
Hi Pietro,

Does your stylesheet run correctly outside eXist? (for example in Oxygen or with Saxon on command-line?)

Regards,
Alister

On 12 Aug 2016, at 6:40 AM, Pietro Liuzzo <[hidden email]> wrote:

Hi,

I would like to use some xslt in my app in exist 2.2. I have in this some named templates with parameters which have values set from variables within the xslt library.

in the xslt, example.xslt I have: 

.....

<xsl:variable name="singletoncount">

... a lot of stuff here...

</xsl:variable>

<xsl:call-template name="leafs">
           <xsl:with-param name="singletons">

<xsl:value-of select="string-length($singletoncount)"/>

</xsl:with-param>

</xsl:call-template>


....

 <xsl:template name="leafs">

        <xsl:param name="singletons"/>

 <xsl:variable name="position" select="$count + $singletons"/>

...


</xsl:template>


in my xquery

transform:transform(
       
$document,
       
'xmldb:exist:///db/apps/myapp/xslt/example.xsl'
       
,
 
<parameters>
   
<param name="singletons" value="."/>
</parameters>

    )


I get an error if I don't set the parameter value (<param name="singletons"/>) but if I leave it empty or simply don't add the parameter in the xquery the transformation obviously does not work. 

How shall I do this?

Thanks a lot!
Pietro

--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Xquery and XSLT

Hungerburg
In reply to this post by Pietro Liuzzo
Am 2016-08-11 um 23:10 schrieb Pietro Liuzzo:

> I get an error if I don't set the parameter value
> (<param *name*=*"singletons"/>*) but if I leave it empty or simply don't
> add the parameter in the xquery the transformation obviously does not work.
>
> How shall I do this?
>
> Thanks a lot!
> Pietro

What is it exactly that you want to achieve?

Omit a named parameter?

--
peter

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Xquery and XSLT

Alister Pillow-3
In reply to this post by Alister Pillow-3
What is the error when you run the transformation without parameters?

transform:transform(
        
$document,
        
'xmldb:exist:///db/apps/myapp/xslt/example.xsl'
        
,()
    )


On 12 Aug 2016, at 7:10 AM, Pietro Liuzzo <[hidden email]> wrote:

yes, indeed!

On 11 August 2016 at 23:30, Alister Pillow <[hidden email]> wrote:
Hi Pietro,

Does your stylesheet run correctly outside eXist? (for example in Oxygen or with Saxon on command-line?)

Regards,
Alister

On 12 Aug 2016, at 6:40 AM, Pietro Liuzzo <[hidden email]> wrote:

Hi,

I would like to use some xslt in my app in exist 2.2. I have in this some named templates with parameters which have values set from variables within the xslt library.

in the xslt, example.xslt I have: 

.....

<xsl:variable name="singletoncount">

... a lot of stuff here...

</xsl:variable>

<xsl:call-template name="leafs">
           <xsl:with-param name="singletons">

<xsl:value-of select="string-length($singletoncount)"/>

</xsl:with-param>

</xsl:call-template>


....

 <xsl:template name="leafs">

        <xsl:param name="singletons"/>

 <xsl:variable name="position" select="$count + $singletons"/>

...


</xsl:template>


in my xquery

transform:transform(
       
$document,
       
'xmldb:exist:///db/apps/myapp/xslt/example.xsl'
       
,
 
<parameters>
   
<param name="singletons" value="."/>
</parameters>

    )


I get an error if I don't set the parameter value (<param name="singletons"/>) but if I leave it empty or simply don't add the parameter in the xquery the transformation obviously does not work. 

How shall I do this?

Thanks a lot!
Pietro

--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open




--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Xquery and XSLT

Pietro Liuzzo
thanks a lot for the suggestions!

the error I got without parameters was simply that nothing was done from the named templates with those parameters, no formal error was reported by the app. 

The problem was within one of the transformations but I was getting the error from the transform:transform() function only, so testing as suggested has been very helpful to find out where actually the problem was, although the only way to get updates from modifications on included xslt is removing them and running the xquery without and then again with the modified template. 

Going by trial and mistake it looks like declaring the parameters this way in the xquery does the job:

<param name="singletons" value="."/>

Thanks a lot!
Pietro


On 12 August 2016 at 00:07, Alister Pillow <[hidden email]> wrote:
What is the error when you run the transformation without parameters?

transform:transform(
        
$document,
        
'xmldb:exist:///db/apps/myapp/xslt/example.xsl'

        
,()
    )


On 12 Aug 2016, at 7:10 AM, Pietro Liuzzo <[hidden email]> wrote:

yes, indeed!

On 11 August 2016 at 23:30, Alister Pillow <[hidden email]> wrote:
Hi Pietro,

Does your stylesheet run correctly outside eXist? (for example in Oxygen or with Saxon on command-line?)

Regards,
Alister

On 12 Aug 2016, at 6:40 AM, Pietro Liuzzo <[hidden email]> wrote:

Hi,

I would like to use some xslt in my app in exist 2.2. I have in this some named templates with parameters which have values set from variables within the xslt library.

in the xslt, example.xslt I have: 

.....

<xsl:variable name="singletoncount">

... a lot of stuff here...

</xsl:variable>

<xsl:call-template name="leafs">
           <xsl:with-param name="singletons">

<xsl:value-of select="string-length($singletoncount)"/>

</xsl:with-param>

</xsl:call-template>


....

 <xsl:template name="leafs">

        <xsl:param name="singletons"/>

 <xsl:variable name="position" select="$count + $singletons"/>

...


</xsl:template>


in my xquery

transform:transform(
       
$document,
       
'xmldb:exist:///db/apps/myapp/xslt/example.xsl'
       
,
 
<parameters>
   
<param name="singletons" value="."/>
</parameters>

    )


I get an error if I don't set the parameter value (<param name="singletons"/>) but if I leave it empty or simply don't add the parameter in the xquery the transformation obviously does not work. 

How shall I do this?

Thanks a lot!
Pietro

--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open




--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)




--
Pietro Maria Liuzzo
cel (DE): +49 (0) 176 61 000 606
Skype: pietro.liuzzo (Quingentole)

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open