<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [jdom-interest] JDOM XSLT</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Thanks Laurent.</FONT>
<BR><FONT SIZE=2>I am using xalan with JDOM. The problem is even if i give a</FONT>
<BR><FONT SIZE=2>smaller chunk in the template match it seems to output the whole</FONT>
<BR><FONT SIZE=2>tree</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element root = new Element(&quot;Stock&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.addContent(new Element(&quot;Company&quot;).addContent(&quot;xyz&quot;));</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.addContent(new Element(&quot;Company&quot;).addContent(&quot;abc&quot;));</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element subRoot = new Element(&quot;Price&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subRoot.addContent(new Element(&quot;List&quot;).addContent(&quot;$100&quot;));</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subRoot.addContent(new Element(&quot;List&quot;).addContent(&quot;$200&quot;));</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element sub2Root = new Element(&quot;Demand&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub2Root.addContent(new Element(&quot;priority&quot;).addContent(&quot;low&quot;));</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub2Root.addContent(new Element(&quot;priority&quot;).addContent(&quot;high&quot;));</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.addContent(subRoot);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.addContent(sub2Root);</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document doc = new Document(root);</FONT>
</P>

<P><FONT SIZE=2>for the xsl :</FONT>
</P>

<P><FONT SIZE=2>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</FONT>
<BR><FONT SIZE=2>&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;<A HREF="http://www.w3.org/1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform</A>&quot; xmlns:fo=&quot;<A HREF="http://www.w3.org/1999/XSL/Format" TARGET="_blank">http://www.w3.org/1999/XSL/Format</A>&quot;&gt;</FONT></P>

<P><FONT SIZE=2>&lt;xsl:template match=&quot;/Stock/Price&quot;&gt;</FONT>
<BR><FONT SIZE=2>&lt;xsl:element name=&quot;SelectedPrice&quot;&gt;&lt;xsl:value-of select=&quot;List[2]&quot; /&gt;&lt;/xsl:element&gt;</FONT>
<BR><FONT SIZE=2>&lt;/xsl:template&gt;</FONT>
<BR><FONT SIZE=2>&lt;/xsl:stylesheet&gt;</FONT>
</P>

<P><FONT SIZE=2>Outputs :</FONT>
</P>

<P><FONT SIZE=2>getText() being called for Company</FONT>
<BR><FONT SIZE=2>getText() being called for Company</FONT>
<BR><FONT SIZE=2>getText() being called for List</FONT>
<BR><FONT SIZE=2>getText() being called for List</FONT>
<BR><FONT SIZE=2>getText() being called for priority</FONT>
<BR><FONT SIZE=2>getText() being called for priority</FONT>
</P>

<P><FONT SIZE=2>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</FONT>
<BR><FONT SIZE=2>xyzabc&lt;SelectedPrice xmlns:fo=&quot;<A HREF="http://www.w3.org/1999/XSL/Format" TARGET="_blank">http://www.w3.org/1999/XSL/Format</A>&quot;&gt;$200&lt;/Selected</FONT>
<BR><FONT SIZE=2>Price&gt;lowhigh</FONT>
</P>

<P><FONT SIZE=2>Is there anyway i can hide a part of the tree from being outputted every time i do the</FONT>
<BR><FONT SIZE=2>transformation?</FONT>
</P>

<P><FONT SIZE=2>mani</FONT>
</P>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Laurent Bihanic [<A HREF="mailto:laurent.bihanic@atosorigin.com">mailto:laurent.bihanic@atosorigin.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Wednesday, April 17, 2002 4:54 PM</FONT>
<BR><FONT SIZE=2>To: Mani Doraisamy</FONT>
<BR><FONT SIZE=2>Cc: jdom-interest@jdom.org</FONT>
<BR><FONT SIZE=2>Subject: Re: [jdom-interest] JDOM XSLT</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>Mani Doraisamy wrote:</FONT>
<BR><FONT SIZE=2>&gt; Hi all,</FONT>
<BR><FONT SIZE=2>&gt; I have a huge JDOM datastructure. when i do XSLT,</FONT>
<BR><FONT SIZE=2>&gt; does it output the whole tree or does it query only</FONT>
<BR><FONT SIZE=2>&gt; those mentioned in the stylesheet?</FONT>
</P>

<P><FONT SIZE=2>JDOM can't know the content of the stylesheet so it passes the whole document </FONT>
<BR><FONT SIZE=2>content to the XSLT processor as a flow of SAX events. Based on that your XSLT </FONT>
<BR><FONT SIZE=2>processor may choose to either rebuild the whole document in memory or process </FONT>
<BR><FONT SIZE=2>it by small chunks. You may try different implementations.</FONT>
</P>

<P><FONT SIZE=2>It also depends on the way you wrote your stylesheets. If you have match </FONT>
<BR><FONT SIZE=2>statements that select large parts of the document, chances are good that the </FONT>
<BR><FONT SIZE=2>XSLT processor requires the whole document to be loaded before stating processing.</FONT>
</P>

<P><FONT SIZE=2>&gt;&nbsp; And how about namespace documents ?</FONT>
</P>

<P><FONT SIZE=2>There are no namespace documents. Namespace URIs are just unique identifiers, </FONT>
<BR><FONT SIZE=2>they don't have to point to existing documents. XML parsers do not try to load </FONT>
<BR><FONT SIZE=2>any data from namespace URIs.</FONT>
</P>

<P><FONT SIZE=2>Hope this helps,</FONT>
</P>

<P><FONT SIZE=2>Laurent</FONT>
</P>

</BODY>
</HTML>