Re: system-properties(), was Re: p:xslt

"Dave Pawson" <dave.pawson@gmail.com> writes:

>>> I started this to get a string back from p:system-property()
>>>
>>> Do I have to run an xslt step to obtain this?
>>> I.e. to use xpath?
>>
>> That dpeends, what do you want to do with the string?
>
> Initially just have a look at its parameters.
> Thought I'd try and output a system parameter as a way of using it.
> Due to the parameter malarky I'm having a great difficulty accessing it!

System properties and parameters are entirely unrelated, so I'm confused.

> E.g.
> In a pipeline
>
> <p:xslt name="trsf">
>   <p:input port='stylesheet'>
>     <p:document href="step1.xsl"/>
>   </p:input>
>   <p:input port='parameters' select=""/>
> </p:xslt>
>
> causes an npe from Saxon/calabash.

An NPE? Bug report that, please:
http://code.google.com/p/xmlcalabash/issues/list

> But
>
> <p:xslt name="trsf">
>   <p:input port='stylesheet'>
>     <p:document href="step1.xsl"/>
>   </p:input>
> </p:xslt>
>
> Shows
>
> [dpawson@marge tests]$ calabash.sh -i source='step1.xml' step1.xpl
> Error
>   Cannot find a matching 1-argument function named
> {http://www.w3.org/ns/xproc}system-property()

Have you tried to use p:system-property *inside* the XSLT stylesheet?
That won't work.

Try something like this:

<p:xslt name="trsf">
  <p:parameter name="product-name" select="p:system-property('p:product-name')"/>
  <p:input port="stylesheet">
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    version="1.0">
      <xsl:param name="product-name"/>
      <xsl:template match="/">
        <doc><xsl:value-of select="$product-name"/></doc>
      </xsl:template>
    </xsl:stylesheet>
</p:xslt>

> I have both saxon9-s9api.jar and calabash in my classpath
>
> The stylesheet just uses xsl:value-of
> select="p:system-property('p:product-name')"

Yeah. You can't do that. The XProc extension functions aren't available
*inside steps* they're only available in the pipeline.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | The important thing is not what the
http://nwalsh.com/            | author, or any artist, had in mind to
                              | begin with but at what point he decided
                              | to stop.--D. W. Harding

Received on Friday, 12 December 2008 16:38:07 UTC