[xsl] RE: XSL-List Digest V4 #316

Subject: [xsl] RE: XSL-List Digest V4 #316
From: Soumen Sarkar <SoumenS@xxxxxxxxx>
Date: Wed, 1 May 2002 11:26:53 -0700
I have written a paper on use of XSLT for Java code generation.

http://www.theserverside.com/resources/article.jsp?l=XMLCodeGen

In our large Java project, 60% of code is generated, in the following
areas:

* EJB code generation from UML model in XML. This goes like this:

  - Express entity-relationship model among EJBs in UML and capture
    that in XML form.

  - Use XSLT scripting on UML/XML model of EJB to generate

    1. HOME, REMOTE, BEAN classes
    2. XML deployment descriptor
    3. SQL schema for entity beans

  Custom code is "mixed" with generated code via inheritance as it is
  in CORBA.

* SNMP manager side code generation. This goes like this:

  - Somehow convert SNMP MIB in XML form. For example some
    MIB browsers compile SNMP BIB and has option to export compiled
    MIB in XML/HTML form.

  - Use XSLT scripting on SNMP MIB in XML form to generate manager/agent
    side code genration.

* Application configuration. This goes like this:

  - Express application configuration in XML schema.

  - Use XSLT scripting on XML schema to generate code for file/db based
    persistence and GUI forms.

I am really very much into source code generation by XSLT scripting. So
if you need further help, please contact me.

Soumen Sarkar.


-----Original Message-----
From: owner-xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Tuesday, April 30, 2002 11:30 PM
To: xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx
Subject: XSL-List Digest V4 #316


XSL-List Digest         Wednesday, May 1 2002         Volume 04 : Number 316



In this issue:

     Re: [xsl] Code Generation
     [xsl] Updated XSLT 2.0 and XPath 2.0 drafts
     Re: [xsl] struggling with table titles
     Re: [xsl] Code Generation
     RE: [xsl] Code Generation
     RE: [xsl] problem in using * as a default parameter in xsl:param
     [xsl] XSLTInputHandler error  

----------------------------------------------------------------------

Date: Tue, 30 Apr 2002 15:39:11 -0500
From: doug@xxxxxxxxxxx
Subject: Re: [xsl] Code Generation

Can anyone point me towards XML/XSLT resources for generating Java source
code?  I'm looking for a simple working template that builds a basic .java
file so that I can customize it to build more complex methods than the
setter/getter methods that are generated by other frameworks I've been
investigating.

Regards,

Doug


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

Date: Tue, 30 Apr 2002 22:52:20 +0100
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Subject: [xsl] Updated XSLT 2.0 and XPath 2.0 drafts

New drafts of the XSLT 2.0, XPath 2.0, and XQuery 1.0 specifications have
been published:

http://www.w3.org/TR/xslt20
http://www.w3.org/TR/xmlquery-use-cases
http://www.w3.org/TR/xpath20
http://www.w3.org/TR/xquery
http://www.w3.org/TR/query-datamodel/
http://www.w3.org/TR/xquery-operators/


I have also issued Saxon 7.1 as the next installment of my XSLT 2.0/XPath
2.0 implementation efforts: see http://saxon.sf.net/saxon7.1/changes.html


Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

Date: Wed, 01 May 2002 00:10:57 +0200
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Subject: Re: [xsl] struggling with table titles

pandianoliver@xxxxxxxxxxxx wrote:
> i have a table which runs for about 3 to 4 pages? How
 > can I append {continue} to the table title to each the
 > following pages after the first page.

There is no easy way to do this. Look here for a hint
how to kludge it:
  http://www.biglist.com/lists/xsl-list/archives/200202/msg01119.html

J.Pietschmann


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

Date: Wed, 01 May 2002 00:32:40 +0200
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Subject: Re: [xsl] Code Generation

doug@xxxxxxxxxxx wrote:
> Can anyone point me towards XML/XSLT resources for generating Java source
> code?  I'm looking for a simple working template that builds a basic .java
> file so that I can customize it to build more complex methods than the
> setter/getter methods that are generated by other frameworks I've been
> investigating.

Cocoon generates Java source from XSP files using XSLT.
The most important point is to use the text output method
and perhaps an output encoding the Java compiler doesn't
choke on.
Further issues are whether you want to have a human
redable output, beautifully indented (you have to do it
yourself, indent="yes" doesn't work here), and how you
want to relate problems reported by the compiler or
during run time (stack traces) to your source XML or
the boilerplate code in your style sheet. Saxon has
a lineNumber() extension function, which can help here
(put the source line number in a comment).

Here is also a simplistic example (caution: badly designed
XML):

XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<class name="stuff">
   <attribute name="foo" type="int"/>
</class>

XSL
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0">
   <xsl:output method="text" encoding="ISO-8859-1"/>

   <xsl:template match="class">
     <xsl:text>public class </xsl:text>
     <xsl:value-of select="@name"/>
     <xsl:text> {&#x0A;</xsl:text>
     <xsl:apply-templates select="attribute"/>
     <xsl:text>}&#x0A;</xsl:text>
   </xsl:template>

   <xsl:template match="attribute">
     <xsl:text>  private </xsl:text>
     <xsl:value-of select="@type"/>
     <xsl:text> </xsl:text>
     <xsl:value-of select="@name"/>
     <xsl:text> ;&#x0A;</xsl:text>
     <xsl:text>  public </xsl:text>
     <xsl:value-of select="@type"/>
     <xsl:text> get</xsl:text>
     <xsl:value-of select="@name"/>
     <xsl:text> () { return </xsl:text>
     <xsl:value-of select="@name"/>
     <xsl:text> ; }&#x0A;</xsl:text>
   </xsl:template>
</xsl:stylesheet>

J.Pietschmann


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

Date: Tue, 30 Apr 2002 18:43:35 -0400
From: "Sal Mangano" <smangano@xxxxxxxxxx>
Subject: RE: [xsl] Code Generation

You might want to check out ejen http://ejen.sourceforge.net/. I never
personally used it but it sounds interesting.

What type of code do you want to generate? Where is the source of the
XML that will drive the generation? 


BTW, I have done a lot of work in this area - generating C++ and Java
from XML using XSLT. I am working on a book that will be out in October
2002 that will cover this topic in detail. However, it sounds like you
need something right away! 

It would be helpful for me to understand the types of code generation
tasks people would like to perform. This will help me better structure
my examples. Feel free to email me at smangano@xxxxxxxxxxx


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-
> list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of doug@xxxxxxxxxxx
> Sent: Tuesday, April 30, 2002 4:39 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Code Generation
> 
> 
> Can anyone point me towards XML/XSLT resources for generating Java
source
> code?  I'm looking for a simple working template that builds a basic
.java
> file so that I can customize it to build more complex methods than the
> setter/getter methods that are generated by other frameworks I've been
> investigating.
> 
> Regards,
> 
> Doug
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

Date: Tue, 30 Apr 2002 23:15:37 +0000
From: "=?big5?B?qkwgpGyq5A==?=" <minikittygo@xxxxxxxxxxx>
Subject: RE: [xsl] problem in using * as a default parameter in xsl:param

hi all

thanks for your answers, however,  i was wondering what happens if it is 
there are more than one parameter within the xpath expression? is there an 
legant solution for it?
i.e. 
<xsl:param name="param1" select="'*'"/>
<xsl:param name="param2" select="'*'"/>
...
<xsl:for-each select="elementName[childName/something1=$param1 and 
$childName/something2=$param2]>
...

Furthermore, i was wondering how will you set the parameter if the 
parameter consist of white spaces (e.g. parameter='this is my parameter'), 
in xalan-C command line will ignore the 'is', 'my' and 'parameter' and 
throws an XPathParserexception error. do i use normalize-space($param1)? 
but it seem it doesn't work, please help.
 
Many thanks
regards
Kit

p.s. can i use the following parameter for a xsl:for-each statement using 
xalan:evaluate? (e.g. "a/c='hello world'") sorry about throw so many 
questions at the same time

_________________________________________________________________
&b1z*:&f0J8K8m$W6G0e15&, Hotmail 6l%s!A=P2>&\!Ghttp://mobile.msn.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

Date: Tue, 30 Apr 2002 20:10:36 -0400
From: pandianoliver@xxxxxxxxxxxx
Subject: [xsl] XSLTInputHandler error  

Hi Gurus, 
I have been struggling with the convertion to PDF using FOP. It was working
well for the past few weeks and all of a sudden I am getting this exception
error and I have tried everything I could think of.  Now, I am seeking for
your help!!!!  The exception error occurs on the call to <XMLReader
p=ih.getParser();> 
I have tried both the fop versions 0.20.3 and 0.20.1.  both are producing
the same error. 

Please help me get going! 

Thank you 
  

Oliver 



__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------

End of XSL-List Digest V4 #316
******************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread