Subject: [xsl] should document-uri work like this? From: Fred Christian <fredc@xxxxxxxxxxxxxx> Date: Sat, 1 Jan 2011 14:30:20 -0800 |
I am using the document() function to access another xml file, but I am having trouble getting my relative URI to work. Two solution ideas. 1. Use document-uri to get a base uri to work from. 2. Find a way to modify my saxon command line call. (Saxon 9 HE, using Java command line, I have 2.0 specified as my xsl version) 1. I have a current result-document being output and am trying to get document-uri to work. See the following <xsl:variable name="folder" select="format-number(position(), '00')"/> <xsl:variable name="file">sp.html</xsl:variable> <xsl:variable name="wb">./<xsl:value-of select="$folder"/>/subfolder/index.xml</xsl:variable> <xsl:result-document href="./{$folder}/{$file}"> <xsl:variable name="thisdoc" select="document-uri(.)"/> ==<xsl:value-of select="base-uri()" />-TEST-base-uri ==<xsl:value-of select="$thisdoc" />-TEST-document-uri ==<xsl:value-of select="$wb" />-TEST-wb <xsl:if test="document($wb)"> <script language="javascript" src="whiteboards/links.js"/> </xsl:if> </xsl:result-document> ------------- In my current output, my file 01/sp.html file is getting created properly. It has this at the top where the TEST output is ==file:/C:/Users/Fred/Desktop/Test/IPC2/08_Files_Test/../xml/chapter.xsl-TEST -base-uri ==-TEST-document-uri ==./01/subfolder/index.xml-TEST-wb Note: My document-uri function isn't returning any value. If I get that to output something then I hope to change my if statement to something like,. <xsl:if test="document($wb,$thisdoc)"> Two questions here. - How do I get document-uri to work? - Once I do, should this idea work to make the document() function have a base-uri to resolve from? ------- In my second solution idea of modifying the saxon command line call, I haven't been able to figure that out and it wouldn't be as flexible anyways. But if there is a way to make a change so the document() function resolves from my source xml file instead of the xsl file that would be helpful to learn. command line I am currently using java -cp c:\Saxon9\saxon9he.jar net.sf.saxon.Transform -s:C1\indexC1.xml -xsl:..\xml\chapter.xsl -o:C1\toc.html ----- Thanks Fred
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Thread | Re: [xsl] should document-uri work , Graydon | |
Date | Re: [xsl] should document-uri work , Graydon | |
Month |