Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Modifying Source Data from XSLT

Reply
Thread Tools

Modifying Source Data from XSLT

 
 
Jamie Jackson
Guest
Posts: n/a
 
      06-08-2006
[Warning, XSLT noob.]

In the XML source I'm working with, some node values that should be
identical, vary slightly from value to value. The differences are in
whitespace (some have a carriage return mid-string).

Ideally, I'd like to normalize-space() all of the values of the
underlying data, so that I later use and reuse the cleaned data
throughout the rest of the transformation (so I could properly use
distinct-values() on that list, etc.).

Is there a way to modify the underlying data, as opposed to having to
clean it each time you come to it?

Thanks,
Jamie

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      06-08-2006
Jamie Jackson wrote:
> Is there a way to modify the underlying data, as opposed to having to
> clean it each time you come to it?


You can't alter the source document -- expect by taking a two-pass
approach, one pass to create the altered source and then a second pass
to style from that. The two passes can be done in a single stylesheet,
with some work, if you're either using XSLT2 or are willing to use the
EXSLT node-set() function -- build the altered tree in a variable, then
style from that -- but of course this doubles your memory use and means
touching everything twice, so it may not be a net win.
 
Reply With Quote
 
 
 
 
Jamie Jackson
Guest
Posts: n/a
 
      06-08-2006

Joe Kesselman wrote:
> Jamie Jackson wrote:
> > Is there a way to modify the underlying data, as opposed to having to
> > clean it each time you come to it?

>
> You can't alter the source document -- expect by taking a two-pass
> approach, one pass to create the altered source and then a second pass
> to style from that. The two passes can be done in a single stylesheet,
> with some work, if you're either using XSLT2 or are willing to use the
> EXSLT node-set() function -- build the altered tree in a variable, then
> style from that -- but of course this doubles your memory use and means
> touching everything twice, so it may not be a net win.


Okay, it's probably not worth the trouble, but good to know, thanks.

I've come up with a decent, simple workaround for my current issue, so
I'm set for today.

Thanks,
Jamie

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
modifying source at runtime - jython case Jan Gregor Python 7 11-08-2005 07:19 AM
XSLT modifying an xml dom tree? Prashanth Ellina XML 6 08-02-2005 06:25 AM
Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) Author Tarun Tyagi C Programming 0 12-29-2004 05:10 PM
Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) Author Tarun Tyagi Cisco 0 12-29-2004 05:03 PM
PyDoc modifying the source. Paradox Python 1 12-08-2003 04:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57