XSD+XSL to HTML form - using JSP/Servlet


I’m new here…

I’m developing an application with Java (JSP and/or servlet)

I must generate an HTML form from a XML-Schema and use a given XSLT to
show it with a certain layout.

[B]So, in short:

Input: pippo.xsd and pippol.xsl

Output: pippo.html (or anything that could be seen on a browser as a
normal HTML form).[/B]

Obviously I must add javascript field type control to validate the
form on the give XSD, before sending it… but it’s another story.

I need all help that you can do, suggestions, tips. I’m a sort of
newbie with JSP and this kind of problem.

[I]Note: Someone told me that I must validate both given files, but how
can I validate a XSD and/or a XSL, without a given XML file? I’m using

Software I’m using:
JDK, JRE 1.5, Xerces-J2, Xalan-J, Tomcat 5.5

Note2: I’m using Apache2 but I’m not able to connect it with Tomcat 5.5 using JK1.3… I tried a lot of “methods” found on the net :_([/I]

You have to use JK2 to connect Apache2 and Tomcat 5.5. You can find it here:

As for setup instructions, you can find them here:

thank you Garcia.

But I hope that there’s an expert that could help me to take the right way to solve my problem…

I need the idea of the general structure, I’m just a newbie of JSP/servlets.

I had 2 inputs: XSD and XSL
and 2 outputs: XML file and HTML form
I need to know how to structure the code to avoid a mess…
I’m using xerces and xalan… but I’m just a newbie with JSP and I’m not sure about the correct way to solve the problem for a webapp…

I can use only JSP? I must use a servlet? both?
If it can be solved only by JSP, could I use recursion with it?

please HELP if you can obviously!

hi dakkar,
I know it has been a long time. But this sounds interesting.
Did u able to implement this functionality, if yes can you provide the details here?

Yes I did it… 3 years ago :slight_smile:
actually I can do it MUCH better! ^_^:cool:

Hi Dakkar Daemor.

Please, Can you show some example of XSD and XSL, which generate HTML page?

It’s very important for me. :frowning:

Thank you!

ok, so this thread is like really really old! also, maybe try Google? Search for XML XSLT HTML tutorial or something like that. There are plenty of online tutorials explaining how to do this. If it’s very important to you then do a bit of reading on the topic and you’ll see it’s not too hard.


Today i try to find some info about this problem, but can’t find anything (search in google).

Thanks for your answer.

If you just want an example of how to transform XML to HTML using an XSL, here’s one


For more detailed information on XSL see this:


w3schools generally has pretty good tutorials.

Here’s another article which I haven’t read completely but it looks like it should help


Thank you for your answer.


Can you see XML codes in attachment?

with this example codes - i know how to transform XML to HTML with XSL.
i can’t transform XSD to HTML whith this XSL code.

I know, that an XSD is an XML, i read more sites about XML.
But i can’t understand, why this XSD and XSL codes - not worked.

Sorry for my bad english.

Thank you.

XSD is a schema definition, it servers only to validate an XML file. I’m not sure what kind of transformation is possible with just the XSD…

The attachment hasn’t been approved so I can’t take a look at it yet.

Thank you rozner, for you answers. If i solve this question - i’ll tell you :slight_smile:

Create HTML page from XSD with XSL - is really possible, but now, i can’t tell you - how :frowning:

y approximate thoughts:
<xsl:stylesheet version=“1.0”

<xsl:template match=“xsd:element”>


Solved problem:

<?xml version=“1.0”?>
<xsd:element name=“document”>
<xsd:element name=“fio” type=“xsd:string”/>
<xsd:element name=“bday” type=“xsd:date”/>
<xsd:element name=“workaddress” type=“xsd:string”/>

XSL - which create HTML from XSD

<?xml version=“1.0”?>
<xsl:stylesheet version=“1.0” xmlns:xsd=“…XMLSchema” xmlns:xsl=“…Transform”>
<xsl:output method=“html”/>
<xsl:template match=“xsd:schema”>
<xsl:for-each select=“xsd:element/xsd:complexType/xsd:sequence/xsd:element”>
<xsl:value-of select=“@name”>




That is all!