W3C home > Mailing lists > Public > xproc-dev@w3.org > August 2015

Re: Passing a variable to p:document href?

From: dvint <dvint@dvint.com>
Date: Tue, 25 Aug 2015 12:57:01 -0700
Message-ID: <3nbongd4dr3xpodsytdhv2f7.1440532621865@email.android.com>
To: Jostein Austvik Jacobsen <josteinaj@gmail.com>
Cc: "dvint@dvint.com" <dvint@dvint.com>, XProc Dev <xproc-dev@w3.org>

    
Thanks still getting used to xproc. I also realized this was a place where everything could be specified relative to the xproc file location.


Sent from my T-Mobile 4G LTE Device

-------- Original message --------
From: Jostein Austvik Jacobsen <josteinaj@gmail.com> 
Date: 08/25/2015  12:50 PM  (GMT-08:00) 
To: dvint@dvint.com 
Cc: XProc Dev <xproc-dev@w3.org> 
Subject: Re: Passing a variable to p:document href? 

Hi Dan.
In `<p:document href="$Makexsltfile"/>`, the variable in the href attribute is not evaluated, it is taken literally which is why the error is saying that the file "$Makexsltfile" could not be read.
You will need to load the document referenced by your variable and pipe it into the p:xslt step. Have a look at p:load.
Something like this should work I think (untested):
 <p:declare-step type="l:flatten-map">
        <p:option name="Makexsltfile" required="true"/>

        <p:input port="source"/>
        <p:output port="result">            <p:pipe step="flatten-map" port="result"/>        </p:output>

        <!-- Process the DITAMAP file source to travel all the included
maps and topics with stylesheet to flatten the structure and
gather information for later processing. -->
        <p:xslt name="flatten-map">
            <p:input port="source"/>
            <p:input port="stylesheet">
                <p:pipe step="Makexsltfile" port="result"/>
            </p:input>
            <p:input port="parameters">
                <p:empty/>
            </p:input>
            <p:load name="Makexsltfile">                <p:with-option name="href" select="$Makexsltfile"/>            </p:load>            <p:sink/>

        </p:xslt>

Best regardsJostein

On 25 August 2015 at 20:13,  <dvint@dvint.com> wrote:
If I want to pass a value in when calling an XPROC script that will be the

filename/URI for the document element, is there a way I can do this.



I was looking for the p:with-option but that doesn't exist and it doesn't

look like variable expansion is occurring. I get this error:



"err:XD0011 : Could not read: $Makexsltfile It is a dynamic error if the

resource referenced by a p:document element does not exist, cannot be

accessed, or is not a well-formed XML document.

C:\work\svn\scripts\translations\$Makexsltfile"



I have this:



   <l:flatten-map>

        <p:with-option name="Makexsltfile" select="$Makexsltfile"/>

    </l:flatten-map>



Defined as:



    <p:declare-step type="l:flatten-map">

        <p:option name="Makexsltfile" required="true"/>



        <p:input port="source"/>

        <p:output port="result"/>



        <!-- Process the DITAMAP file source to travel all the included

maps and topics with stylesheet to flatten the structure and

gather information for later processing. -->

        <p:xslt name="flatten-map">

            <p:input port="source"/>

            <p:input port="stylesheet">

                <p:document href="$Makexsltfile"

                />

            </p:input>

            <p:input port="parameters">

                <p:empty/>

            </p:input>



        </p:xslt>





I don't really want to include the XSLT in my XPROC as that makes it hard

to develop the stylesheet as well as it is long enough that I don't want

it to confuse the situation. But at the moment it seems to be the only way

around this problem.



..dan
Received on Tuesday, 25 August 2015 19:57:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:17:25 UTC