[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Reading external XML file XSLT2.0


Subject: Re: [xsl] Reading external XML file XSLT2.0
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 8 May 2013 11:08:58 +0100

On 8 May 2013 10:57, Pankaj Chaturvedi <Pankaj.Chaturvedi@xxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I am wondering what could be possibly wrong with my code, while I am
> trying to read external XML (book_meta.xml) file in my style sheet. The
> codes looks like below. I am working on Windows on XSLT2.0
>
>       <xsl:variable name="extNode" select="tokenize(document-uri(.),
> '\.')[last()-2],'book_meta.xml'"/>
>
>        <xsl:value-of select="$extNode/book-meta/book/@author"/> Error
> shows here
>
> Engine name: Saxon-EE 9.3.0.5
> Severity: fatal
> Description: Required item type of first operand of '/' is node();
> supplied value has item type xs:string

It's because $extNode is actually a string (or sequence of strings by
the looks of it).  You probably want

doc($extNode)/book-meta/.......

...with a tweak to $extNode to create a single string.



-- 
Andrew Welch
http://andrewjwelch.com


Current Thread
Keywords
xml