Here is the right solution:

1. fourth argument is arrayref to the array of paramater name/value 
pairs, Is is not your case, so set it to undef. (It works together wirh 
xsl:param instruction)

2. First three parameters defines template, document and output. You use 
it correctly

3. Additional arguments (XML chunks) are passed together with template 
and data

Try this (w/o my typos)

$sab = new XML::Sablotron();
$sab->RunProcessor("arg:/template", "arg:/data", "arg:/output",
                     undef, ["template", $stylesheet, "data", $data,
                             "nav", $hash{nav}]);
$result = $sab->GetResultArg("output");

Of course, you may use the older "Process" call.

Note, that "nav" have to be a valid XML document.

Pavel

Christopher Rivera wrote:

> I'm experiencing a problem trying to supply a buffer with a chunk of XML,
> and using the XML::Sablotron. I'm not entirely certain if I'm using it in
> the correct manner, but here is what I'm trying to accomplish...
> 
> I'm using XML::Sablotron with the following:
> 
> case A:
>     XML::Sablotron::Process(
>       "arg:/template", "arg:/data", "arg:/output", ["nav", $hash{'nav'}],
>       ["template", $stylesheet, "data", $data], $output,
>     );
> 
>       -or-
> 
> case B:
>     XML::Sablotron::Process(
>       "arg:/template", "arg:/data", "arg:/output", \@mybuf,
>       ["template", $stylesheet, "data", $data], $output,
>     );
> 
> 
> $hash{'nav'} contains a chunk of XML
> \@mybuf is referencing %hash
> 
> 
>>From my stylesheet, I'm using a for-each loop on "document('arg:/nav')//*"
> 
> some of the errors I have received are:
> from the stylesheet - 'arg:/nav' not found
>   or
> too many arguments (referring to the use of Process)
> 
> 
> granted I've used a few variations of the Process, by suppling an ARREYREF
> as for the buffer, case A, case B, and to be honest, I'm lost. Does anyone
> have any experience using buffers with XML::Sab, and can you best advise on
> this situation?


-- 
Pavel Hlavnicka
Ginger Alliance Ltd.
Prague; Czech Republic

Reply via email to