Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 23rd, 2008, 12:18 PM
Authorized User
 
Join Date: Jan 2008
Location: Austin, TX, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dved Send a message via Yahoo to dved
Default Converting String into Node-set

Usage in SAXON9

I am wondering if I can directly convert a String into xml Node set and return it. Currently my code gets a node set(doc in java). Java code does what it needs to do and then returns a HTML in a string.

I want to return a Node-set and not a string. Currently I m using :
String S="<tr>"
DocumentBuilderFactory factory= DocumentBuilderFactory.newDocumentBuilder();
DocumentBuilder builder=factory.newDocumentBuilder();
document html=builder.parse(newInputSource(new StringReader(S)));

then create more childs and keep adding to this string.

then return Document;

Is there another cleaner way.

Thanks
__________________
Thanks
Dved
Reply With Quote
  #2 (permalink)  
Old January 23rd, 2008, 12:23 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Are you asking how to do the same kind of thing, but in XSLT?

There is no way to do this in standard XSLT, but seeing as you are using Saxon then you can use the Saxon extension function, saxon:parse().

http://www.saxonica.com/documentatio...ons/parse.html

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old January 23rd, 2008, 12:23 PM
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Your question subject "converting string into node-set" sounds as if you are looking for the saxon:parse extension function: http://www.saxonica.com/documentatio...ons/parse.html

Reply With Quote
  #4 (permalink)  
Old January 23rd, 2008, 12:40 PM
Authorized User
 
Join Date: Jan 2008
Location: Austin, TX, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dved Send a message via Yahoo to dved
Default

I already have a java function(called in xsl) which returns a string. Now I need to do something (in my java function) so that I convert this string into a document may be and return it to XSL. So XSL reads it as a node set and not as a string.

If I use the method that I said before then I have to go and change each line as I need to append a chile everytime. So I was looking for a kind of type cast mechanism which makes this string into a document or any form that XML understands (like nodeset) but a string.

Note: the problem with string is that it contains < and > symbols and these get interpreted by XSL as &lt and &gt. I dont want it that way.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath: set operation with a disjoint node set rich_unger XSLT 7 May 6th, 2008 09:24 AM
converting node to string mister_mister XSLT 2 January 24th, 2008 12:23 PM
Filtering out from a node set anothervbaddict XSLT 1 May 22nd, 2007 08:42 AM
Converting a set of string to its ascii value... rittwick Beginning VB 6 4 April 2nd, 2007 10:46 AM
node-set function Bernardo Pacheco XSLT 2 June 19th, 2006 10:45 AM



All times are GMT -4. The time now is 07:55 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.