[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [xslt v1.0] How to parse the string as node-set?
[Hmmm. I sent this 2012-09-29 10:14 (before I had received Ken Holman's "2 steps or vendor extension" reply), but it doesn't seem to have made it to the list. Since the technique demonstrated for doing 2 XSLT steps from a shell commandline is potentially useful to OP and others, I'm trying again.] I'd do this in two passes. Presuming you have "xmlstarlet" installed and in your shell path as `xmlstarlet`[1], the following (all on one line, of course) should do the trick. $ xmlstarlet select --text -N T=http://xmlexchangeservice.com/ --template --match "//T:InputXML" --value-of "." input.xml | xmlstarlet select -N tns=urn:schemas:x12:org:V00200806:CoverageRequest --xml-decl --template --match "//tns:Organization" --copy-of "." (I've used long options to make it clearer to readers who aren't familiar with xmlstarlet's switches.) If you don't have xmlstarlet, you can obviously do the same thing by actually writing the two stylesheets: one that extracts <InputXML> into a file as text, and another that reads in that file as XML. Notes ----- [1] Some package managers install xmlstarlet as the `xml` command.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|