Modifying Source Data from XSLT

J

Jamie Jackson

[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
 
J

Joe Kesselman

Jamie said:
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.
 
J

Jamie Jackson

Joe said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top