473,758 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

including xml file in xslt?

hi..

i'm trying to figure out if i can include an extenal file of xml inside
xslt, what i need is a configuration file which xslt can query duing
transformation, (we are talking about a rather large document here.
i thought about using document function, since i'm gonna thiis called
about hunders of times i don't know the impact this would have on
performance (does xsll keeps opening closing a file?)

May 8 '06 #1
7 1297
> i thought about using document function, since i'm gonna thiis called
about hunders of times i don't know the impact this would have on
performance (does xsll keeps opening closing a file?)


Odds are that most XSLT processors will cache documents referenced by
document() -- it's the easiest way to implement some of the
unique-identity requirements. If you want to make sure it gets cached
you could do a single document() call and assign to a (global?) variable.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
May 8 '06 #2

Elhanan wrote:
i thought about using document function, since i'm gonna thiis called
about hunders of times i don't know the impact this would have on
performance


The standards don't specify performance-critical behaviours like that -
so whatever you do, build a simple benchmark first and measure it. It
rarely takes long to do, in the overall project complexity.

May 8 '06 #3
thanks you mean assign it to a global variable and then do all my xpath
queries on that var? how can i do that?

now i have a much bigget problem, i'm trying to parse my xsl file with
xpath query, to remove certian bits, now i find out i cannot do any
xpath queries at all!

i look over at the samples and copied but still it doesn't work.
DocumentBuilder Factory f = DocumentBuilder Factory.newInst ance();
DocumentBuilder b= f.newDocumentBu ilder();
org.w3c.dom.Doc ument doc=b.parse("AT map.xml");

XPathFactory xp=XPathFactory .newInstance();
XPath xpa=xp.newXPath ();
xpa.setNamespac eContext(new MyNamespaceCont ext());

XPathExpression xe=xpa.compile( "//foo:document");

Node when =(Node)xe.evalu ate(doc,XPathCo nstants.NODE);
System.out.prin tln(when);
}catch (Exception e){
e.printStackTra ce();
}

and the xml is:
<?xml version='1.0'?>
<foo:document xmlns:foo="http ://apache.org/foo"
xmlns:bar="http ://apache.org/bar">
<bar:element>My Bar</bar:element>
</foo:document>

and yet i keep getting null!!, i'm going crazy here.

May 8 '06 #4
never mind got it, i should have place
setNameSpaceAwa re()!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!

May 8 '06 #5
Elhanan wrote:
thanks you mean assign it to a global variable and then do all my xpath
queries on that var? how can i do that?


<xsl:variable name="something " select="documen t('foo.xml')/stuff"/>

///Peter
--
XML FAQ: http://xml.silmaril.ie/
May 8 '06 #6
yea but how do i xpath on that variable?

May 10 '06 #7
Elhanan wrote:
yea but how do i xpath on that variable?


If the variable contains a nodeset, you can use it as the root of an
XPath -- $foo/bar/baz[@murph] or whatever to start your search from the
nodes in variable $foo.

If it contains a Result Tree Fragment (RTF), you need to use the EXSLT
nodeset function (or whatever equivalent your processor supports) to
turn it into a nodeset first; then proceed as above.

Note that in XSLT 2.0, the distinction between those two goes away; any
expression that returned one or the other will return a Temporary Tree,
which can be used in expressions the way nodesets are in 1.0.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 10 '06 #8

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

Similar topics

4
2446
by: Fredrik Henricsson | last post by:
Hey, I'm building an ontology in Protégé and I want to transform parts of it (e.g. the instances) to HTML with XSL. When I was transforming another file with 'simple' XML-tags like <author> before, I got it working, but the OWL-file is formatted differently and I don't know how to access the elements. I'll post the .owl file below, but this is basically what I want to get from the file (the course name): <Course...
5
1418
by: hilz | last post by:
Hi, I am trying to style an rss feed. i created a stylesheet, and an xml file. i include the stylesheet and the rss feed file into my xml file. when i open my xml file in IE, everything works fine. when i open it in firefox, it doesn't work. does anybody know if there is antyhing i can do to make this work in firefox?
2
3235
by: Marcelo | last post by:
Hi Guys, I have the following question. I have a Xerox DJDE File that I want to convert to PDF.
4
1677
by: dar_imiro | last post by:
Hi, I'm trying to get rid of frames as menu holder in my html-page. I'd also like to separate the menu structure to xml and xslt. Also the actual content is divided to xml and its corresponding stylesheet. The idea ofcourse is to import the separate menu.xml to the content.xslt file so the menu markup wont clutter every content.xml page.
2
1167
by: griffithsj_520 | last post by:
I have to create a web page to give to clients that is shipped on CD. The idea is that they would open the page and it would display in their web browser. What this will do is to provide a list of most recent changes to the software we're shipping. The idea is that there would be an un-ordered list <ul/> with a list of changes (not sure of final desired mark-up). What we want to do is to get the developers to edit a file that simply...
6
4995
by: Lenny Wintfeld | last post by:
Hi I'm attempting additions/changes to a Java program that (among other things) uses XSLT to transform a large (96 Mb) XML file. It runs fine on small XML files but generates OutOfMemory exceptions with large XML files. I tried a simple punt of -Xmx512MB but that didn't work. In the future, the input XML file may become considerably bigger than 96 MB, so even if it did work, it probably would be putting off the inevitable to some later...
3
2530
by: danmc91 | last post by:
Hello, I'm new to xml and xslt but that should be obvious from my question. I'm trying to help my wife set up some web pages with some of her art work and what I'm trying to do is find a way to get all of the information about the pictures in an XML file and then use xslt to produce some different html files. My first problem is I can't seem to figure out how to get this to
20
3152
by: Johan | last post by:
How can I include one XML file into another XML file (on the client side, in Firefox)? I think XInclude is just what I need, but Firefox doesn't support it: https://bugzilla.mozilla.org/show_bug.cgi?id=201754 It seems I also can use an "external entity reference", but that depends on a DTD and I'm using XML Schema. Is it also possible with a Schema and how can I do it?
2
2255
by: Cameron.MacNeil.024 | last post by:
Hi folks, hopefully I posted this question in the right place. I'm currently writing an html file which references three different xml files, each one with its own xsl stylesheet. Originally I used framesets to display each file, and everything worked fine. However, this method produces an ugly page with too many scroll bars, and I want to simplify the look. I spent a good deal of time looking up ways to include html files within...
0
9492
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9908
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9740
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7287
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2702
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.