Can any one suggest good XSLT with java tutorials?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
I use Apache Xalan so I recommend you to learn it
If you don't know XSL w3schools has a good one for getting started
There are three steps to learning XSLT on Java:
1- Pick a XSLT engine.
Each engine is slightly different, but for basic processing any will do.
Xalan has always worked well for me. To get started, all you need to do is download the Xalan jar(s) from here and put them in your project's classpath. The file you need is one of the
xalan-j_X_X_X-bin-2jars
files.Then use the following code to process a sample XML within a Java program (adapted from SimpleTransform.java, not tested):
2- Learn XPath.
XPath is the syntax used to select elements within an input XML file.
It also allows provided basic functions to do some processing. Although XPath is a major part of XSLT, it can be used independently to process XML files.
For example, Dom4j and most XML parsers provide the ability to select elements using the XPath syntax. I can't recommend any specific tutorial, but searching XPath tutorial provides a number of good results.
3- Learn the XSLT format.
XSLT is simply XML. The XSLT specification can be found here.
There are plenty of tutorials out there. Just start from a simple example and build your knowledge from there. Some of the key points to remember:
The Sun Java website is usually a good place to begin, here's an article for J2EE.