473,387 Members | 1,530 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,387 software developers and data experts.

How generate one file for each class in xml using xslt and java?

Hi,

I have one xml file with many class elements. For each class element I
need to generate a new new java file.As it is now I get ( my output )
all classes in one file. Do I control this in the code for the
transformer or in the xsl-template? Where can I find information about
this?

Your help is very much appreciated,

//Mikael
Jul 20 '05 #1
2 2085
ted
Take a look at the Saxon parser. It processes the <xsl:result-document>
element which will output to multiple documents.

Put something like this in your xsl:

<xsl:for-each select="yourClass">
<xsl:variable name="fileName" select="concat(@className, '.java')">
<xsl:result-document href="$fileName">
<!-- put your Java code here -->
</xsl:result-document>
</xsl:for-each>

"Petterson Mikael" <mi**************@era.ericsson.se> wrote in message
news:3F***************@era.ericsson.se...
Hi,

I have one xml file with many class elements. For each class element I
need to generate a new new java file.As it is now I get ( my output )
all classes in one file. Do I control this in the code for the
transformer or in the xsl-template? Where can I find information about
this?

Your help is very much appreciated,

file://Mikael

Jul 20 '05 #2
ted
I forgot to close the <xsl:variable> element. It should be:

<xsl:variable name="fileName" select="concat(@className, '.java')"/>

"ted" <te************@yahoo.com> wrote in message
news:hU*****************@newsread3.news.pas.earthl ink.net...
Take a look at the Saxon parser. It processes the <xsl:result-document>
element which will output to multiple documents.

Put something like this in your xsl:

<xsl:for-each select="yourClass">
<xsl:variable name="fileName" select="concat(@className, '.java')">
<xsl:result-document href="$fileName">
<!-- put your Java code here -->
</xsl:result-document>
</xsl:for-each>

"Petterson Mikael" <mi**************@era.ericsson.se> wrote in message
news:3F***************@era.ericsson.se...
Hi,

I have one xml file with many class elements. For each class element I
need to generate a new new java file.As it is now I get ( my output )
all classes in one file. Do I control this in the code for the
transformer or in the xsl-template? Where can I find information about
this?

Your help is very much appreciated,

file://Mikael


Jul 20 '05 #3

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

Similar topics

1
by: Tim:. | last post by:
Hi Can someone tell me how I generate a new XML file that I can then use with an XSLT file. I am trying to use an XML file generated from Microsoft Project or even better generate an XML file from...
4
by: Fredrik Henricsson | last post by:
Hey, I'm building an ontology in Protégé and I want to transform parts of it (e.g. the instances) to HTML with XSL. When I was transforming another file with 'simple' XML-tags like <author> before,...
2
by: Matt | last post by:
Hello, I would like to generate what I call an "overall class hierarchy" in UML automatically derived from my C++ code source. An example of what I seek: ...
4
by: Stephen | last post by:
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather...
4
by: sysxperts | last post by:
Hi, I have a mail server that generates archives in a directory for every message sent or received and each archive has an associated XML file with <sender>, <receiver>, <subject> and other...
6
by: Lenny Wintfeld | last post by:
Hi I'm attempting additions/changes to a Java program that (among other things) uses XSLT to transform a large (96 Mb) XML file. It runs fine on small XML files but generates OutOfMemory...
1
by: lennyw | last post by:
Hi I'm trying to use XSLT to do an xml to xml transformation where the output xml contains summary data on the information in the input xml. I've succesfully done a Muenchian grouping of the...
5
by: sjangity | last post by:
I am generating xml file that will populate users in a database. assigned_to contains names of developers. reporter contains names of quality engineers. I can't simply just create users...
4
by: Nick | last post by:
I have a critical requirement where I need to club together 4 xml files and display them in an sibngle HTML report. The xmls are generated by Java application by a normal file I/O. Is there a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.