This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Transforming data through Xalan


Hi All,

Thank you for providing a forum like this for newbies like me.

My problem is that:

I have a JSP page which displays the various columns and look and feel based
on the selections made by user during account setup. This "metadata" is
stored in an XML file.

While displaying the page I want to read the metadata, read a Java
collection (Vector) holding the records and convert it into SAX events on
the fly and apply one standard XSL to it. SAX events are generated for only
those data columns whose equivalent metadata have text value "Y". All this
transformation needs to be done at server-side only.

The solution that I have been working with is

1- take input from user in a JSP page process the request and write the XML
file.

2- To generate the output XML, I parse this xml file into a dom tree and get
the Java Bean holding the Vector of Java objects to been displayed. I
generate the elements through my own parser extending XMLReader interface
(only those elements that need to be shown)

3- the XML generated by the TransformerHandlerIdentity contenthandler is
correct but when I plug the stylesheet into TransformerHandler the XSL
transformation do not get applied.

I have traced the transformation through the xalan debugging classes and the
output says

"file:///c:/ims/xsl/scheme.xsl Line #5, Column #25: template match='/'
STARTDOCUMENT
file:///c:/ims/xsl/scheme.xsl Line #6, Column #21: table
file:///c:/ims/xsl/scheme.xsl Line #7, Column #40: for-each
file:///c:/ims/xsl/scheme.xsl Line #7, Column #40: for-each, select='null':
     [empty node list]
STARTELEMENT: table
ENDELEMENT: table
ENDDOCUMENT


for the xsl file which reads like

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="html"/>

<xsl:template match="/">
  <table border="1">
   <xsl:for-each select="issues/issue">
     <tr>
     <xsl:apply-templates/>
     </tr>
    </xsl:for-each>
  </table>
</xsl:template>
 <xsl:template match="column">
 <td>
     <xsl:value-of select="@name"/>
 </td>
 </xsl:template>
</xsl:stylesheet>

I would be glad to provide any information needed.

TIA,
Regards,
Pavitra Jain


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]