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

Re: redirecting ouput to a different file?

Subject: Re: redirecting ouput to a different file?
From: Dan Vint <dvint@xxxxxxxxx>
Date: Thu, 18 Aug 2011 17:49:32 -0700
Re:  redirecting ouput to a different file?
So I can drop that <xsl:result-document href="DMC-{modelic}-{sdc}-{chapnum}-.... into all of my templates? I hadn't found any complex examples in my searches, but was hoping it would work like what you describe.

thanks
..dan


At 05:18 PM 8/18/2011, you wrote:
At 2011-08-18 15:16 -0700, dvint@xxxxxxxxx wrote:
I'm working in v2.0. I'm thinking that <xsl:result-document> might be the
solution, but I haven't fully absorbed the implications or process. So
here is the probelm.
I have an input document that has a name like
DMC-GAASIB0-01-32-00-00-00000-051A-B_000-00.xml. In that document is a
bunch of tags that have the data that makeup this name:

            <avee>
               <modelic>GAASIB0</modelic>
               <sdc>01</sdc>
               <chapnum>32</chapnum>
               <section>0</section>
               <subsect>0</subsect>
               <subject>00</subject>
               <discode>00</discode>
               <discodev>000</discodev>
               <incode>051</incode>
               <incodev>A</incodev>
               <itemloc>B</itemloc>
            </avee>
...
The question here is, can I read file of one name and output all this
result to a new file name based upon the values in the mapping file?

Yes.


  <xsl:template match="avee">
    <xsl:result-document href="DMC-{modelic}-{sdc}-{chapnum}-....
      ...blah...
    </xsl:result-document>
  </xsl:template>

I'm thinking that I have to write all the content to a variable as a
nodeset (not create any output), then send that nodeset content via
xsl:result-document to the new file name.

Not at all. As long as you write nothing to the default result tree, nothing will be created for the standard output. In my example above, the built-in template rule processes the document element without adding anything to the default result tree, and the template above only creates a named result document tree rather than the default result tree, so you only get the document you name above. No need to stage stuff in a variable.


Am I going in the right direction or is there something else I should
consider?

If I've understood your requirement, it is easier than you think.


I hope this helps.

. . . . . . . . . Ken

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--------------------------------------------------------------------------- Danny Vint

Panoramic Photography
http://www.dvint.com

voice: 619-938-3610

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.