473,385 Members | 2,029 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,385 software developers and data experts.

Reading XSLT from Java

Hi,

I am new to XSLT and I would like to use Java to read up the XSLT
content and add in a few tags in into the template below:

<xsl:template name="hwSpecs">
<!-- adding new tags into here from Java -->
</xsl:template>

So, what kind of parser or tools can I use in my Java source code to
deal with this?

Many thanks.

Mike

Dec 13 '05 #1
5 1653
cybernerdsx2 wrote:
I am new to XSLT and I would like to use Java to read up the XSLT
content and add in a few tags in into the template below:

<xsl:template name="hwSpecs">
<!-- adding new tags into here from Java -->
</xsl:template>

So, what kind of parser or tools can I use in my Java source code to
deal with this?


XSLT is XML-based, so you can use e.g. an XML DOM parser to do that.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Dec 13 '05 #2
Thanks. Can I use JDOM for doing that?
Any simple example to, say, read the tag <xsl:template name="hwSpecs"> ?

Dec 13 '05 #3
cybernerdsx2 wrote:
Thanks. Can I use JDOM for doing that?
I think you can.
Any simple example to, say, read the tag <xsl:template name="hwSpecs"> ?


I don't use JDOM. But there should be a method to read all template
elements from XSLT 1.0 namespace. Then get the element with the specific
name attribute value.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Dec 13 '05 #4


cybernerdsx2 wrote:

I am new to XSLT and I would like to use Java to read up the XSLT
content and add in a few tags in into the template below:

<xsl:template name="hwSpecs">
<!-- adding new tags into here from Java -->
</xsl:template>

So, what kind of parser or tools can I use in my Java source code to
deal with this?


Java 1.4 and later has XSLT 1.0 support so one way to do that is to
write an XSLT 1.0 stylesheet that processes an input stylesheet and
generates a new output stylesheet. After all, XSLT is XML so you can use
XSLT itself to process and to generate XSLT.

Or you could write a Java program using the W3C DOM to parse the input
stylesheet into a DOM tree and then use the DOM API to add elements.
Then you need to serialize to DOM tree to get a new XML document file.

Besides those tools built-in for Java 1.4 or 1.5 you can of course have
a look at the various third party implementations for XSLT, DOM.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 13 '05 #5
In Java, for XSLT, You can do all the things that you can do in XML
"cybernerdsx2" <fo*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Thanks. Can I use JDOM for doing that?
Any simple example to, say, read the tag <xsl:template name="hwSpecs"> ?

Dec 15 '05 #6

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

Similar topics

1
by: Johannes Lebek | last post by:
Hi there, somehow, I cannot access nodes that are stored in a variable. I'm using Xalan 2.5.1 and the following commands: ================ BEGIN ==================== <xsl:variable...
4
by: Thomas Honold | last post by:
Hi there, I want to generate C++ or Java code by script, e.g. classes with getter/setter methods. Someone told me that nowadays it is done with XML and XSLT. I should use - XML File which...
2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
4
by: Thomas Mann | last post by:
Hi, how can I make my XSLT-stylesheet insert a timestamp (date/time) into the output file ? Regards Thomas
6
by: Robbie Baldock | last post by:
Hi - I'm a bit of a newbie to the world of XSLTs but am trying to call a Java method on a parameter passed into an XSLT but am having problems. I've stripped the XSLT down to its bare bones: ...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
7
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
1
by: Rajesh | last post by:
I am trying to pass the namespace, which is in my Original Message, to a Java method for further processing. In the original message the xmlns:xenc namespace is present. I make a call to Java...
6
by: John Larson | last post by:
Hi All, I am some information from INSPEC database records in XML to build a relational database of my own. I am currently trying to extract information by doing an XSLT transform of the XML...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
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...

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.