473,394 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Odd behavior on xsl:include / xsl:import - Figure this one out?

I have been running some tests with regards to xsl:include and xsl:import
with the same results on both and I am wondering if someone can explain this
behavior to me!

First off the xslt file is being loaded as in

dim myXSLT as new XslTransform()
myXSLT.load("scripts/clnt.home.body.xslt")

The load craps out when I change the xsl:include, tried all of the following
is xsl:import as well. The file contains a href to a file called
clnt.cmn.xslt. It contains some standard templates with names that render
particular html that is common to the site. The file is stored in a physical
directory, C:\allianceShared\xslt\clnt.cmn.xslt.

The directory allianceShared is a virtual directory in the web site called
shared and resides at the root. The transform file I am loading is off the
root within a directory called scripts. Here is the structure laid out

c:\allianceShared
xslt\
clnt.cmn.xslt

c:\AllianceNet (Website root, domain name
http://allianceNet)
shared\ (Virtual directory pointing at
c:\allianceShared)
scripts\
clnt.home.body.xslt (transformation file being loaded)
home.aspx (file making the call )

Now here is the strange thing on loading the clnt.home.body.xslt file from
within home.aspx

example 1 : works
<xsl:import href="c:\allianceShared\xslt\clnt.cmn.xslt"/> - works

example 2: works, surprise!
<xsl:import href="http://allianceNet/shared/xslt/clnt.cmn.xslt"/>

example 3: fails
<xsl:import href="../shared/xslt/clnt.cmn.xslt"/>
Now thinking that '..' usually means something else in the xslt world I
created the same virtual directory 'shared' under the scripts directory,
hence the next example/

example 4: fails
<xsl:import href="shared/xslt/clnt.cmn.xslt"/>

Now what is interesting is, example 1 works even though you are supposed to
be supplying an href? If example 2 works, meaning that it does recognize the
virtual directory 'shared' why would example 3 or 4 fail?

Of note I have other xslt files that have xsl:import statements with the
href="../somefile.xslt" and they work, but only if they are dealing with
physical directories in the web site not virtual ones.

Any thought on this?

Looking forward to seeing if Oleg can explain this one :-)

Cheers
Keith
Nov 12 '05 #1
2 3210
Keith Chadwick wrote:
Now here is the strange thing on loading the clnt.home.body.xslt file from
within home.aspx

example 1 : works
<xsl:import href="c:\allianceShared\xslt\clnt.cmn.xslt"/> - works

example 2: works, surprise!
<xsl:import href="http://allianceNet/shared/xslt/clnt.cmn.xslt"/>

example 3: fails
<xsl:import href="../shared/xslt/clnt.cmn.xslt"/>
Now thinking that '..' usually means something else in the xslt world I
created the same virtual directory 'shared' under the scripts directory,
hence the next example/

example 4: fails
<xsl:import href="shared/xslt/clnt.cmn.xslt"/>

Now what is interesting is, example 1 works even though you are supposed to
be supplying an href? If example 2 works, meaning that it does recognize the
virtual directory 'shared' why would example 3 or 4 fail?

Of note I have other xslt files that have xsl:import statements with the
href="../somefile.xslt" and they work, but only if they are dealing with
physical directories in the web site not virtual ones.

Any thought on this?


Well, actually relative URI references in xsl:import instruction (ones
who don't work for you) are resolved relatively to base URI of the
xsl:import element node itself (hence base URI of the master stylesheet
clnt.home.body.xslt in your case).
So if both stylesheets are in the same dir, try
<xsl:import href="clnt.cmn.xslt"/>

Another issue - make sure you are loading clnt.home.body.xslt stylesheet
preserving its base URI (e.g. not from string or stream), otherwise
obviously XSLT processor won't be able to resolve relative URI references.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #2
Thanks Oleg you twigged my brain regarding the load of the file. I was
using server.mappath("url") instead of a fully qualified URI. Everything
works fine now.

Cheers
Keith

"Oleg Tkachenko" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...
Keith Chadwick wrote:
Now here is the strange thing on loading the clnt.home.body.xslt file from within home.aspx

example 1 : works
<xsl:import href="c:\allianceShared\xslt\clnt.cmn.xslt"/> - works

example 2: works, surprise!
<xsl:import href="http://allianceNet/shared/xslt/clnt.cmn.xslt"/>

example 3: fails
<xsl:import href="../shared/xslt/clnt.cmn.xslt"/>
Now thinking that '..' usually means something else in the xslt world I
created the same virtual directory 'shared' under the scripts directory,
hence the next example/

example 4: fails
<xsl:import href="shared/xslt/clnt.cmn.xslt"/>

Now what is interesting is, example 1 works even though you are supposed to be supplying an href? If example 2 works, meaning that it does recognize the virtual directory 'shared' why would example 3 or 4 fail?

Of note I have other xslt files that have xsl:import statements with the
href="../somefile.xslt" and they work, but only if they are dealing with
physical directories in the web site not virtual ones.

Any thought on this?


Well, actually relative URI references in xsl:import instruction (ones
who don't work for you) are resolved relatively to base URI of the
xsl:import element node itself (hence base URI of the master stylesheet
clnt.home.body.xslt in your case).
So if both stylesheets are in the same dir, try
<xsl:import href="clnt.cmn.xslt"/>

Another issue - make sure you are loading clnt.home.body.xslt stylesheet
preserving its base URI (e.g. not from string or stream), otherwise
obviously XSLT processor won't be able to resolve relative URI references.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vince C. | last post by:
Hi all, I've created XML documents that are described with a schema. I'm using those documents to create web pages. All my web pages contain a fixed header and a variable document part. The...
2
by: Robert Kattke | last post by:
I'm working with Tomcat and have all my XSL files in a dir under WEB-INF. I wanted to set up some variables in an XSL, then import it into others. However, without any path specified it (zalan)...
5
by: Shiju Rajan | last post by:
Hi, I have one transformation called transform1.xsl. transform1.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="transform2.xsl"/>...
1
by: bjam | last post by:
Hi, today I was able to abstract out into a separate xsl file a template that I specifically perform a call templates for, this worked with import no problem. However, when trying to do the same...
0
by: atlantis | last post by:
Hi, I have a very strange problem with xsl:import when usig RELATIVE path on AIX 5.2 server. I have two XSL files in the same directory: "ists_xslt3.xsl" and "ists_xslt3_layout.xsl". This...
4
by: Keith Chadwick | last post by:
I have 3 individual ASP.NET applications that make up the overall web application. Each of these websites share some common styles, scripts and xslt files. These are all placed in a single...
2
by: alex.iskold | last post by:
Hi, i am having the following problem: A style sheet imports another stylesheet: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:include...
0
by: jephperro | last post by:
Hi, I'm trying to do something with multiple xml files and am wondering if it is possible. I have 2 XML feeds: One is a list of locations, LOC.XML One is a list of products,PROD.XML I...
2
Dormilich
by: Dormilich | last post by:
Hi, my goal is to have a stylesheet, where I can change the encoding attribute of the <xsl:output> element (one shall have utf-8 and the other latin-1). is there any way to set this via a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.