Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2006, 01:30 AM
Registered User
 
Join Date: Dec 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL transformation problem

hi,

i am trying to display XML string in a webpage using XSLT. this XSL uses another XML file to display labels on that page. here is the code that calls labels XML file.

<xsl:variable name="culture"><xsl:value-of select="VUFile/Language/Culture"/></xsl:variable>

<xsl:variable name="doc" select="concat('/Project/FileViewerResources.',$culture,'.xml')"/>

when i m running my application from c:\inetpub\wwwroot\Project, its running fine, but when i run the same application from another path, say c:\Code\Project, instead of taking the relative path, its still looking for file "FileViewerResources.en-En.xml" in c:\inetpub\wwwroot\Project which is the localhost path.
If i change the default website path in IIS to c:\Code\Project, it works fine.

XML containing actual data which is to be displayed is generated as a string at runtime, so no XML file is created for that.

How do i resolve this? requirement is that it should pick file from relative path and not from localhost directory.

Please Help!
Thanx
 
Old December 4th, 2006, 07:27 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Presumably you are passing $doc to the document() function. When you do this, it is interpreted as a relative URI that is relative to the base URI of the stylesheet. If you want it treated as relative to somewhere else (like your "current working directory") you may be able to achieve this using the second argument to the document() function, but the simplest way is probably to pass in the current working directory as a stylesheet parameter and construct the absolute path "by hand". This is all a lot easier in XSLT 2.0 which gives you more control over URI resolution.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old December 5th, 2006, 05:58 AM
Registered User
 
Join Date: Dec 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

i tried using stylesheet parameter to hardcode path but error message is displayed --> "Access is Denied"

here is the code i am using:

<xsl:param name="isolang" select="'en'"/>
<xsl:param name="RelPath" select="'c:\Code\Project'"/>
<xsl:variable name="culture"><xsl:value-of select="VUFile/Language/Culture"/></xsl:variable>
<xsl:variable name="doc" select="concat($RelPath,'/Project/FileViewerResources.',$culture,'.xml')"/>
<xsl:variable name="translation" select="document($doc)/labels[lang($isolang)]"/>

Please correct me if i've done something incorrectly. I am new to XSL and XML and still learning. :)





Quote:
quote:Originally posted by mhkay
 Presumably you are passing $doc to the document() function. When you do this, it is interpreted as a relative URI that is relative to the base URI of the stylesheet. If you want it treated as relative to somewhere else (like your "current working directory") you may be able to achieve this using the second argument to the document() function, but the simplest way is probably to pass in the current working directory as a stylesheet parameter and construct the absolute path "by hand". This is all a lot easier in XSLT 2.0 which gives you more control over URI resolution.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl transformation ... rajesh_css XSLT 5 September 30th, 2008 12:37 AM
XSL-Transformation atulshin XSLT 4 September 15th, 2008 06:37 AM
WML and XSL transformation. Feodorov XSLT 2 February 13th, 2008 05:00 PM
XSL Transformation problem dzyrd7 XSLT 2 November 23rd, 2006 01:24 PM
XSL transformation Thodoris XML 0 May 20th, 2004 08:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.