[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Interesting issue

Subject: RE: Interesting issue
From: Nischal Muthana <nischal_muthana@xxxxxxxxx>
Date: Fri, 22 Nov 2002 09:19:17 -0800 (PST)
xmlns result
Mike,

Are you sure that the
> contents of <lxslt:script> are not actually in a
> CDATA section? 
Thanks for your time. I am sorry that was typo from my
end. I did have the CDATA section. 

> There is a deeper question: what on earth inspired
> you to try and solve this problem this way? It would
>be much easier to do  it in pure XSLT, without any
>Javascript, using the substring() function.

I have tried this too. The xml/xsl I sent are repro of
the real problem. I mean to say the <Customers>/<data>
contains more than 5000 bytes. So to process this big
string I didnt had any other option except using
Javascript. In actual the loop in the Javascript code
I sent executes 200 times.

If you think otherwise about my situation, I would
appreciate your valuable suggestions.

Thanks
Nischal



--- Michael Kay <michael.h.kay@xxxxxxxxxxxx> wrote:
> I find it amazing that this does anything at all.
> Are you sure that the
> contents of <lxslt:script> are not actually in a
> CDATA section? The
> <Customers> element has no end tag, so the
> stylesheet isn't well-formed
> XML as written; and if that were corrected, I would
> find it very
> surprising if Xalan allowed the Javascript syntax
> and the XML syntax to
> cut across each other in this way.
> 
> If you put the script in a CDATA section, of course,
> then the things
> that look like tags just become ordinary character
> data, and you end up
> with a string that looks like unparsed XML - which
> matches the behavior
> you describe as "getting a string instead of a
> node-list". Of course you
> will get unparsed XML if you don't parse it.
> 
> There is a deeper question: what on earth inspired
> you to try and solve
> this problem this way? It would be much easier to do
> it in pure XSLT,
> without any Javascript, using the substring()
> function.
> 
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx  
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On
> Behalf Of 
> > Nischal Muthana
> > Sent: 22 November 2002 06:26
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  Interesting issue
> > 
> > 
> > Hi All
> > 
> > I am transforming xml to xml using an xsl with
> Xalan
> > XSLT processor. But I am getting the resulting xml
> as
> > string instead of 
> > 
> > nodelist.
> > 
> > test.xsl
> > <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:lxslt="http://xml.apache.org/xslt" 
> > 
> > xmlns:result="http://www.example.com/results"
> > extension-element-prefixes="result" version="1.0">
> > <xsl:output method="xml"/>
> > 	<lxslt:component prefix="result"
> > functions="GetCopyBookData">
> > 	<lxslt:script lang="javascript">
> > 	function GetData(Data)
> > 	{
> > 		var x1 = 0;
> > 		var x2 = 0;
> > 		var result;
> > 		for(var i = 1;i < 3; i++)
> > 		{
> > 			var s = "<Customers><FirstName>";
> > 			x1 = x2;
> > 			x2 = x1 + 15;
> > 			s = s + Data.substring(x1,x2) + "</FirstName>";
> > 			s = s + "<LastName>";
> > 			x1 = x2;
> > 			x2 = x1 + 1;
> > 			s = s + Data.substring(x1,x2) + "</LastName>";
> > 			s = s + "<StreetNum>";
> > 			x1 = x2;
> > 			x2 = x1 + 1;
> > 			s = s + Data.substring(x1,x2) + "</StreetNum>";
> > 			s = s + "<Street>";
> >  			x1 = x2;
> > 			x2 = x1 + 1;
> > 			s = s + Data.substring(x1,x2) + "</Street>";
> > 			s = s + "<City>";
> > 			x1 = x2;
> > 			x2 = x1 + 1;
> > 			s = s + Data.substring(x1,x2) + "</City>";
> > 			s = s + "<State>";
> > 			x1 = x2;
> > 			x2 = x1 + 1;
> > 			s = s + Data.substring(x1,x2) + "</State>";
> > 			s = s + "<Zip>";
> > 			x1 = x2;
> > 			x2 = x1 + 1;
> > 			s = s + Data.substring(x1,x2) + "</Zip>";
> > 			result = result + s;
> > 		}
> > 		return result;
> > 	}
> > 	</lxslt:script>
> > 	</lxslt:component>
> > 	<xsl:template match="/">
> > 		<xsl:variable name="Data" select="data"/>
> > 		<xsl:value-of select="result:GetData($Data)"/>
> > 	</xsl:template>
> > 		
> > test.xml
> > <Customers> 
> >
>
<data>SudhakarJalli030719751809Bigbenddrmilpitasca95035Rajeevk
> >
>
asarabada032719751788lowerbenddrivesanjoseca94523</data>
> > </Customers>
> > 
> > 
> > Result.xml
> > 
> > <Customers>
> > 	<FirstName>Sudhakar</FirstName>
> > 	<LastName>Jalli</LastName>
> > 	<DOB>03071975</DOB>
> > 	<StreetNum>1809</StreetNum>
> > 	<Street>BigBendDr</Street>
> > 	<City>Milpitas</City>
> > 	<State>CA</State>
> > 	<Zip>95035</Zip>
> > </Customers>
> > 	<FirstName>Rajeev</FirstName>
> > 	<LastName>Kasarabada</LastName>
> > 	<DOB>03271975</DOB>
> > 	<StreetNum>1788</StreetNum>
> > 	<Street>lowerbenddrive</Street>
> > 	<City>sanjose</City>
> > 	<State>CA</State>
> > 	<Zip>94523</Zip>
> > </Customers>		
> > 
> > Thanks for your time
> > Nischal
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now. 
> http://mailplus.yahoo.com
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus ? Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.