Subject: RE: [xsl] problem with document(concat From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 26 May 2005 15:45:29 +0100 |
When the argument to document() is a node, then the string value of a node is taken as a relative URI and is resolved against the base URI of that node (that is, it's relative to the source document). When the argument is a string, then the string is taken as a relative URI and is resolved relative to the stylesheet. There's a very rarely used feature of the document() function that helps you here: you can supply a second argument which is the node whose base URI is used for resolution. So try: document(concat(., '.xml'), .) Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Wolfhart Totschnig [mailto:a9507073@xxxxxxxxxxxxxxxxx] > Sent: 26 May 2005 15:19 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] problem with document(concat > > Hi, > I am having a problem related to the document() function and would be > thankful if anyone could help me. > > The xslt script I am working on serves to transform an xml > file to html. > The original xml file reads > > ... > <related>314</related> > .... > > which is to indicate that the current file is related to file > "314.xml" > in the same directory. What I would like to do is integrate > the title of > the referenced file into the output html. I tried the following: > > ... > <xsl:for-each select="related"> > <xsl:value-of > select="document(concat(.,'.xml'))//rdf:RDF/rdf:Description/dc > :title"/> > </xsl:for-each> > ... > > Yet it doesn't work. When changing the content of the xml file from > "314" to "314.xml" and doing > <xsl:value-of select="document(.)//rdf:RDF/rdf:Description/dc:title"/> > it works. > Furthermore, concat(.,'.xml') produces the correct string when put > elsewhere, when put inside document(), however, it doesn't work. > > Could anyone tell me why what I originally had in mind > doesn't work? I > tried to integrate the string() function in any way I could think of, > use variables, nothing helped. > > Thanks for your help, > Wolfhart
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] problem with document(concat, Wolfhart Totschnig | Thread | Re: [xsl] problem with document(con, Wolfhart Totschnig |
[xsl] problems with xsl:copy instru, Rahil | Date | RE: [xsl] problems with xsl:copy in, Andrew Welch |
Month |