Hello everyone
I have sucessfully implemented a SAX filter to take a large
XML data file, and strip it down to its essential elements,
and then pass that on to an XSL transformer. (A bare bones example
of the java code is listed at the end) I also need another XML file, a
list of all possible records, which I use for getting additional
information by cross referencing with xsl:key.
The list file only has one type of element, and I need to write
some output for each of them. So if I don't filter the data file
and start running the XSLT on the List file, and iterating through
every element, I can get the data from the Data file easily, by
accessing it via document().
But to use the filter, I seem to have to START processing with the Data
file
and then *it* is what gets passed to the transformer. I don't know how
to immediately switch to the list file, iterate through each of its
elements and refer back to the data file as needed...
I guess I could template-match on the root element of the filtered
data file and jump from that over to the list file...?
Anyway, here is the rudiments of how I am doing the SAX filtering,
and passing to the XSLT:
- - - - - - - - - - - - - - - - - - - -- - - - - - -
FileReader r = new FileReader( xmlDataFile );
XMLReader xr =
XMLReaderFactor y.createXMLRead er("org.apache. xerces.parsers. SAXParser");
KeepSpecificElt sFilter kFilter = new KeepSpecificElt sFilter( xr,
elementsToKeep );
TransformerFact ory tFactory = TransformerFact ory.newInstance ();
SAXTransformerF actory saxTFactory = ((SAXTransforme rFactory) tFactory);
XMLFilter xmlFilter2 = saxTFactory.new XMLFilter( new StreamSource(
xsltFile ) );
xmlFilter2.setP arent( kFilter );
java.util.Prope rties xmlProps =
OutputPropertie sFactory.getDef aultMethodPrope rties("xml");
Serializer serializer = SerializerFacto ry.getSerialize r( xmlProps );
xmlFilter2.setC ontentHandler( serializer.asCo ntentHandler() );
xmlFilter2.pars e( new InputSource(xml DataFile) );
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
I am open to any ideas...
--Jeff 2 1260
I'd suggest: Filter the first, use it as your input document, and have
the stylesheet explicit access the second via paths based on the
document() function. (Or, if you already have the second in memory as a
DOM tree, your XSLT processor *may* let you pass it in as a stylesheet
parameter and treat it as a nodeset -- but that's getting into
non-standardized stuff.)
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Joseph Kesselman wrote: I'd suggest: Filter the first, use it as your input document, and have the stylesheet explicit access the second via paths based on the document() function. (Or, if you already have the second in memory as a DOM tree, your XSLT processor *may* let you pass it in as a stylesheet parameter and treat it as a nodeset -- but that's getting into non-standardized stuff.)
-- Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Thanks, that sounds like a good strategy.
--Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Harolds |
last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005
the pmID is evaluated to "" instead of what the value is set to:
....
xmlItems.Document = pmXML
// Add the pmID parameter to the XSLT stylesheet
XsltArgumentList xsltArgList = new XsltArgumentList();
xsltArgList.AddParam("pmID", "", pmID);
xmlItems.TransformArgumentList = xsltArgList;
|
by: Peter Gloor |
last post by:
What's the difference between the file type extensions .xsl and .xslt? When
to use what?
So far I always created XSLT files thru the appropriate menues in VS.NET.
They automatically become .xslt files. But today I've got some externally
created XSL transformation stylesheets with filetype .xsl. Now I'm confused,
because in all the code examples I coud found the file type .xsl is used.
Except the differnt icon I cannot see any differnce...
|
by: Peter Row |
last post by:
Hi,
I have 2 XML files and 1 XSLT file.
The second XML file has the following declarative 1st line:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
....the 1st one (the one to be transformed) doesn't.
In the transform file I load the 2nd XML file which contains
|
by: Adrian von Bidder |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Yo!
Mostly as a finger-exercise (and because I'm annoyed again and again how
bad the existing solutions are), I'm hacking up a web-based forum (yes,
the 64832th one, I know).
I want to allow some simplified HTML as input language, and use some xsl
|
by: yinglcs |
last post by:
Hi,
I have a newbie XSLT question. I have the following xml, and I would
like to
find out the children of feature element in each 'features' element.
i.e. for each <featuresI would like to look up what each feature
depends on and gerenate a text file. For example, in the following
file, I would like to find out feature A depends on A1 and A2 and
feature B depends on B1 and B2. And write that to a text file.
| |
by: Umagowder |
last post by:
All
I have my class serialised correctly.
I have to apply style sheet to that data and display it in some other format.
Everything works fine,I can not read the following xml tag,
<PrescriptionRefillMeds>
<anyType xsi:type="PrescriptionRefillMed">
<Description>Drug1</Description>
I have written code to conert the object in to the serialising/deserialising in C#.
XSLT has the required namespacses also,not able to read the...
|
by: super.raddish |
last post by:
Greetings,
I am relatively new to, what I would call, advanced XSLT/XPath and I
am after some advice from those in the know. I am attempting to figure
out a mechanism within XSLT to compare the difference between two
source documents and output node-sets which are "different" (changed
or new) to new XML files using xsl:result-document
To describe the problem I have provided some example data below along
with my a portion of my current...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
|
by: SpaceMarine |
last post by:
hello,
im having a discussion w/ one of my associates, and we're are trying
to get a consensus on a possible performance scenario. we're working
a/ 3-rd party component that produces PDFs using "XML-FO", a verbose
description & layout doc. it can accept either:
1) a complete, verbose XML-FO doc
2) data-only XML, plus an XSLT doc to produce valid verbose XML-FO,
which it transforms
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| | |