xsl-list
[Top] [All Lists]

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

2013-05-08 05:09:22
On 8 May 2013 10:57, Pankaj Chaturvedi 
<Pankaj(_dot_)Chaturvedi(_at_)aptaracorp(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--