[
Lists Home |
Date Index |
Thread Index
]
Take a look at the JAXP interface, specifically the classes in
javax.xml.parsers and javax.xml.transform.
There's a choice of products that implement this interface, e.g. Saxon,
Xalan, Oracle, jd.xslt
JAXP itself doesn't currently provide a method like selectNodes() to execute
an XPath expression against a DOM, but many products have such a method.
However, the approach you are using of modifying the stylesheet on the fly
before running it is very inefficient in a servlet environment, because it
means you have to compile the stylesheet each time it's used. This is not a
design I would recommend. But to give you a preferred design, I would need
to know what you are trying to achieve.
Generally the xsl-list at mulberrytech.com is a better place for this kind
of question.
Michael Kay
# -----Original Message-----
# From: Zahida Parveen [mailto:zahida@advcomm.net]
# Sent: 27 February 2004 11:17
# Cc: xml-dev@lists.xml.org
# Subject: [xml-dev] parsing xsl file in java
#
# Thanx to all who answered my previous query "parsing xsl file in java".
# Let
# me explain again what I want to know. Below is a code segment in ASP:
#
# 1. set style = Server.CreateObject("MSXML2.DOMDocument")
# 2. style.async = false
# 3. style.setProperty
# "SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"
# 4. style.load styleFile
#
# 5. Set objRoot = style.documentElement
# 6. Set objField =
# style.selectSingleNode("/xsl:stylesheet/xsl:include[@href='INCLUDEPATH']")
# 7. objField.setAttribute "href", IncTemplatePath
#
# >From this code you can see that an xsl file named "styleFile" is loaded
# by
# parser. On line # 6, the xsl:include node whose attribute
# href='INCLUDEPATH'
# is read. On line # 7, its attribute href is assigned a new value from
# variable IncTemplatePath.
#
# I want to do this whole thing done in ASP code above, in Java Servlets. I
# am
# new to Java Servlets and dont have much idea about Java Parsers also. I
# have
# heard about Xalan. Is it FREE. How to install and configure to use it.
#
# Please help me to do this thing. I ll be waiting for response from all of
# you.
#
# Thanks,
# Zahida
#
#
# -----------------------------------------------------------------
# The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
# initiative of OASIS <http://www.oasis-open.org>
#
# The list archives are at http://lists.xml.org/archives/xml-dev/
#
# To subscribe or unsubscribe from this list use the subscription
# manager: <http://www.oasis-open.org/mlmanage/index.php>
|