You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Robert Taylor <rt...@mulework.com> on 2002/02/09 03:33:08 UTC

Newbie: Limitations of Xalan

Greetings, I'm involved in project that must convert very large XML files
(several hundred Megs) into an HTML file and I was wondering if there are
any known limitations of Xalan when it comes to dealing with transforming
large documents.

BTW, I tried to reach the archives at http://archive.covalent.net/ but could
not get through. I'm on a dial up so it could be my connection. So I
apologize if this question has already been answered.

Thanks,

robert


RE: Newbie: Limitations of Xalan

Posted by Robert Taylor <rt...@mulework.com>.
Thanks to everyone for the advice. 

> -----Original Message-----
> From: Donald Ball [mailto:balld@webslingerZ.com]
> Sent: Saturday, February 09, 2002 7:07 PM
> To: Robert Taylor
> Cc: xalan-j-users@xml.apache.org
> Subject: Re: Newbie: Limitations of Xalan
> 
> 
> On Fri, 8 Feb 2002, Robert Taylor wrote:
> 
> > Greetings, I'm involved in project that must convert very large 
> XML files
> > (several hundred Megs) into an HTML file and I was wondering if 
> there are
> > any known limitations of Xalan when it comes to dealing with 
> transforming
> > large documents.
> 
> it eats up lots of memory. give it a whirl, but it may not be the best
> solution for you. you might try xsltproc from the gnome libxslt package.
> 
> - donald
> 

Re: Newbie: Limitations of Xalan

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 8 Feb 2002, Robert Taylor wrote:

> Greetings, I'm involved in project that must convert very large XML files
> (several hundred Megs) into an HTML file and I was wondering if there are
> any known limitations of Xalan when it comes to dealing with transforming
> large documents.

it eats up lots of memory. give it a whirl, but it may not be the best
solution for you. you might try xsltproc from the gnome libxslt package.

- donald


Re: Copy elements and attributes question

Posted by Raber Chris <cp...@yahoo.com>.
All,

Thanks for your replies on this. Further digging
revealed a bug with jTidy version
jtidy-04aug2000r7-dev. jTidy was mangling the
attributes. I swithched back to jtidy-04aug2000r6 and
everything is good.

The "identity" and copy stuff work fine in Xalan.

Sorry for the fire drill...

-Chris.

--- Peter Davis <pd...@attbi.com> wrote:
> On Monday 11 February 2002 19:26, Raber Chris wrote:
> > Peter,
> >
> > Thanks for the suggestions. Unfortunately I get
> the
> > same results with the code you suggested as I was
> > getting before. A little more background:
> > 
> > [snip]
> > 
> > - What is happing is that the code to copy
> elements
> > and their attributes is picking up one attribute
> of
> > the source element, and then mysteriously adding
> some
> > others! For example, when copying a form element,
> it
> > copies the action attribute but not the name or
> other
> > attributes and it adds attributes that were not in
> the
> > source document at all!
> >
> > Could this have something to do with having the
> output
> > method be html?
> 
> It could... what would really help is if you could
> post a sample of the input 
> and output (I realize your intellectual property is
> important, so you can cut 
> out the irrelevant parts or send it to me
> privately).
> 
> -- 
> Peter Davis
> Ain't no right way to do a wrong thing.
> 		-- The Mad Dogtender


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

Re: Copy elements and attributes question

Posted by Peter Davis <pd...@attbi.com>.
On Monday 11 February 2002 19:26, Raber Chris wrote:
> Peter,
>
> Thanks for the suggestions. Unfortunately I get the
> same results with the code you suggested as I was
> getting before. A little more background:
> 
> [snip]
> 
> - What is happing is that the code to copy elements
> and their attributes is picking up one attribute of
> the source element, and then mysteriously adding some
> others! For example, when copying a form element, it
> copies the action attribute but not the name or other
> attributes and it adds attributes that were not in the
> source document at all!
>
> Could this have something to do with having the output
> method be html?

It could... what would really help is if you could post a sample of the input 
and output (I realize your intellectual property is important, so you can cut 
out the irrelevant parts or send it to me privately).

-- 
Peter Davis
Ain't no right way to do a wrong thing.
		-- The Mad Dogtender

Re: Copy elements and attributes question

Posted by Raber Chris <cp...@yahoo.com>.
Peter,

Thanks for the suggestions. Unfortunately I get the
same results with the code you suggested as I was 
getting before. A little more background:

- I am building a web clipping/transcoding service.

- The service takes a target URL, fetches the
associated document, runs it through jTidy to turn it
into XHTML and then uses Xalan/XSL to clip parts of
the fetched document into what is ultimately served to

the client (a small footprint mobile device).

- Once a subset of the target page is identified, you
typically want to copy that node and its children,
perhaps with some modifications. That's why I am 
interested in XSL code for copying elements and 
attributes.

- What is happing is that the code to copy elements
and their attributes is picking up one attribute of
the source element, and then mysteriously adding some
others! For example, when copying a form element, it
copies the action attribute but not the name or other
attributes and it adds attributes that were not in the
source document at all!

Could this have something to do with having the output
method be html?

Baffled,

-Chris.

--- Peter Davis <pd...@attbi.com> wrote:
> I'm not sure why that wouldn't work, but here's the
> identity template I use 
> in my stylesheets:
> 
> <xsl:template match="node() | @*">
>     <xsl:copy>
>         <xsl:apply-templates select="node() | @*"/>
>     </xsl:copy>
> </xsl:template>
> 
> This was taken from the XSLT specification, it's
> called the "identity" 
> template.  Like I said, I don't know why yours
> didn't work, but I've used 
> this one with Xalan before.
> 
> On Monday 11 February 2002 05:22, Raber Chris wrote:
> > I am trying to write a block of XSL to copy
> elements
> > and their attributes. The code is:
> >
> > 	<xsl:template match="*">
> > 		<xsl:copy>
> > 			<xsl:copy-of select="@*"/>
> > 			<xsl:apply-templates/>
> > 		</xsl:copy>
> > 	</xsl:template>
> >
> > It kind of works but not all attributes are
> > consistently copied. Is this a Xalan bug or is
> there
> > something wrong with this XSL code?
> >
> > TIA,
> >
> > -Chris.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> 
> -- 
> Peter Davis
> Almost anything derogatory you could say about
> today's software design
> would be accurate.
> 		-- K.E. Iverson


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

Re: Copy elements and attributes question

Posted by Peter Davis <pd...@attbi.com>.
I'm not sure why that wouldn't work, but here's the identity template I use 
in my stylesheets:

<xsl:template match="node() | @*">
    <xsl:copy>
        <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
</xsl:template>

This was taken from the XSLT specification, it's called the "identity" 
template.  Like I said, I don't know why yours didn't work, but I've used 
this one with Xalan before.

On Monday 11 February 2002 05:22, Raber Chris wrote:
> I am trying to write a block of XSL to copy elements
> and their attributes. The code is:
>
> 	<xsl:template match="*">
> 		<xsl:copy>
> 			<xsl:copy-of select="@*"/>
> 			<xsl:apply-templates/>
> 		</xsl:copy>
> 	</xsl:template>
>
> It kind of works but not all attributes are
> consistently copied. Is this a Xalan bug or is there
> something wrong with this XSL code?
>
> TIA,
>
> -Chris.
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com

-- 
Peter Davis
Almost anything derogatory you could say about today's software design
would be accurate.
		-- K.E. Iverson

RE: Copy elements and attributes question

Posted by Gary L Peskin <ga...@firstech.com>.
Chris --

Can you supply some sample XML and a work XSLT stylesheet so that we can
try to reproduce the problem?  It's very difficult to look at this
without specifics.  You can send them to me privately if you'd like.

Gary

> -----Original Message-----
> From: Raber Chris [mailto:cpraber@yahoo.com] 
> Sent: Monday, February 11, 2002 5:22 AM
> To: xalan-j-users@xml.apache.org
> Subject: Copy elements and attributes question
> 
> 
> I am trying to write a block of XSL to copy elements
> and their attributes. The code is:
> 
> 	<xsl:template match="*">
> 		<xsl:copy>
> 			<xsl:copy-of select="@*"/>
> 			<xsl:apply-templates/>
> 		</xsl:copy>
> 	</xsl:template>
> 
> It kind of works but not all attributes are
> consistently copied. Is this a Xalan bug or is there
> something wrong with this XSL code?
> 
> TIA,
> 
> -Chris.
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings! 
http://greetings.yahoo.com


Copy elements and attributes question

Posted by Raber Chris <cp...@yahoo.com>.
I am trying to write a block of XSL to copy elements
and their attributes. The code is:

	<xsl:template match="*">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>

It kind of works but not all attributes are
consistently copied. Is this a Xalan bug or is there
something wrong with this XSL code?

TIA,

-Chris.

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

parse proc. instruction

Posted by Guy McArthur <gu...@guymcarthur.com>.
this is more of a general xml question. I'm looking for the best 
(quickest) routine to parse an xml File and return the xml-stylesheet 
processing instruction value, or null if it does not exist. 

One way it seems would be to use the Xalan XPath API (so as not to load an 
external stylesheet), giving it a DOM Node and the XPath expression for 
processing-instruction(xml-stylesheet). Or use DOM directly. But if the 
Document could be huge, perhaps it's best to use SAX. (But how do you tell 
SAX "hey, I've found it, you can stop processing now?" -- do you have to 
throw an exception)?

Anyways, I wrote this code to do it, and would appreciate comment on the 
best way to solve this (rather simple) problem. [Seems a lot of code for 
what could be a single method, but I guess that's the nature of SAX].

--
package test.xml;

import java.io.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;


public class ProcessingInstructionFinder extends DefaultHandler {
      private String data = null;
      private String instruction;
      
      public ProcessingInstructionFinder(String instruction) {
         this.instruction = instruction;
      }

      public String parse(File file) throws ParserConfigurationException, SAXException, IOException {
         SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
         saxParser.parse(file, this);
         
         return data;
      }
      
      public void processingInstruction(String target, String data) throws SAXException {
         if(target.equals(instruction)) this.data = data;
      }
      
      // for testing
      public static void main(String[] args) {
         if(args.length != 2) {
            System.out.println("Usage: java ProcessingInstructionFinder file instruction");
            System.exit(-1);
         }
         
         try {
            ProcessingInstructionFinder finder = new ProcessingInstructionFinder(args[1]);
            String value = finder.parse(new File(args[0]));
            System.out.println(args[1] + " => " + value);
         } catch(Throwable t) {
            t.printStackTrace(System.err);
         }
      }
}



Re: Newbie: Limitations of Xalan

Posted by Morten Primdahl <mo...@it-c.dk>.
Hi Rob,

I've been using Xalan for conversion of a very large
data set recently (several Gb's). I'm fully satisfied.
I tried Saxon (too slow) and Sabletron (too many coredumps)
as well, only Xalan did its job. My only problems were memory
related, and I had a litte fuss with the recursion level.
But all in all, it's definatly a winner - my advice is
to not bother with any other tool. If Xalan cannot handle
your task, I doubt that there are a lot of tools that
can. Good luck, and thanks to the Xalan crew for a great
implementation.

Morten