Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate the HTML from XSD #27

Open
akhilkhandelwal opened this issue Jul 12, 2019 · 5 comments
Open

How to generate the HTML from XSD #27

akhilkhandelwal opened this issue Jul 12, 2019 · 5 comments

Comments

@akhilkhandelwal
Copy link

Hello,
Thank you for wonderful library. I was trying to generate the HTML from one of my XSD.

Following is the java program which I wrote:

`public class XSLTransform
{
public static void main( String [] args ) throws Exception {
if ( args.length < 2 || !args[0].endsWith(".xsl") ) {
System.err.println("usage: XSLTransform file.xsl file.xml");
System.exit(1);
}
String xslFile = args[0], xmlFile = args[1];

    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = 
        factory.newTransformer( new StreamSource( xslFile ) );
    StreamSource xmlsource = new StreamSource( xmlFile );
    StreamResult output = new StreamResult( System.out );
    transformer.transform( xmlsource, output );
}

}`

And I run this program as:

java XSLTransform xsd2html2xml.xsl dynamicui-definitions.xsd.

Output:

Compiler warnings:
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/gui-attributes.xsl: line 413: Attribute 'step' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/gui-attributes.xsl: line 424: Attribute 'step' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/gui-attributes.xsl: line 435: Attribute 'step' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/handlers/default-types.xsl: line 135: Attribute 'data-xsd2html2xml-primitive' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/handlers/default-types.xsl: line 135: Attribute 'data-xsd2html2xml-primitive' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/handlers/default-types.xsl: line 139: Attribute 'data-xsd2html2xml-description' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/handlers/default-types.xsl: line 139: Attribute 'data-xsd2html2xml-description' outside of element.
file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/xsd2html2xml.xsl: line 264: Attribute 'namespace' outside of element.
ERROR: 'Could not compile stylesheet'
FATAL ERROR: 'file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/namespaces.xsl: line 175: Second argument to document() function must be a node-set.'
:file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/namespaces.xsl: line 175: Second argument to document() function must be a node-set.
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/namespaces.xsl: line 175: Second argument to document() function must be a node-set.
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
at XSLTransform.main(XSLTransform.java:16)
Caused by: file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/namespaces.xsl: line 175: Second argument to document() function must be a node-set.
at com.sun.org.apache.xalan.internal.xsltc.compiler.DocumentCall.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.CopyOf.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XslElement.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.If.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.ForEach.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Template.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.createAST(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
... 3 more

file:///C:/xsd2html2xml-3.3/xsd2html2xml-3.3/utils/namespaces.xsl: line 175: Second argument to document() function must be a node-set.
at com.sun.org.apache.xalan.internal.xsltc.compiler.DocumentCall.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.CopyOf.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XslElement.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.If.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.ForEach.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Template.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.typeCheckContents(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.typeCheck(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.createAST(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
at XSLTransform.main(XSLTransform.java:16)

@MichielCM
Copy link
Owner

Do you get the same error with another XSLT compiler, such as libxslt?

@akhilkhandelwal
Copy link
Author

akhilkhandelwal commented Jul 12, 2019 via email

@akhilkhandelwal
Copy link
Author

akhilkhandelwal commented Jul 12, 2019 via email

@akhilkhandelwal
Copy link
Author

akhilkhandelwal commented Jul 12, 2019 via email

@MichielCM
Copy link
Owner

Just use libxslt. You can run it from the command line on Linux or Windows with a one-liner: xsltproc -o form.html xsd2html2xml.xsl dynamicui-definitions.xsd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants