Re: [xsl] Template-matching nodes from input vs nodes in variable based on their position

Subject: Re: [xsl] Template-matching nodes from input vs nodes in variable based on their position
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 18 Jun 2015 05:43:36 -0000
Simply don't specify any type for the $FOO variable:

 <xsl:variable name="FOO">
  <page>Page number 1</page>
  <page>Page number 2</page>
  <page>Page number 3</page>
  <page>Page number 4</page>
  <page>Page number 5</page>
  <page>Page number 6</page>
  <page>Page number 7</page>
 </xsl:variable>

The type by default is a document node, and in this case the provided
transformation produces the expected result.


Cheers,
Dimitre

On Wed, Jun 17, 2015 at 10:15 PM, Jorge . chocolate.camera@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, Jun 17, 2015 at 9:18 PM, Martin Honnen martin.honnen@xxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>> Try
>>   as="document-node()"
>
> It won't work:
>
>     Error at xsl:variable on line 5 column 51 of stylesheet.xsl:
>       XTTE0570: Required item type of value of variable $FOO is
>       document-node(); supplied value has item type element()
>     Failed to compile stylesheet. 1 error detected.
>
> I use document-node() as the type of a variable when importing an
> external XML file into the variable. But in this case, I write the
> contents of the variable in the stylesheet itself.
> 



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread