xsl-list
[Top] [All Lists]

[xsl] Combining two files

2010-12-11 18:31:11
I actually wrote this several years ago when I was just learning XSLT. Since it worked, I moved on to tougher problems. I am embarrassed to ask, but what is it I don’t understand? I could not get these two files combined without doubling one of them until I used “dummy.xml” (an empty xml file) in the bat file command line:

java -jar c:\Users\HP\saxon\saxon9.jar dummy.xml xslt\40Combine.xsl > work\40Combined.xml

My style sheet 40Combine.xsl consists of a single template:

<xsl:template match="/*">
       <xsl:copy>
<xsl:copy-of select="* | document('../work/22Authors.xml')/*/*" copy-namespaces="no"/> <xsl:copy-of select="* | document('../work/35Subjects.xml')/*/*" copy-namespaces="no"/>
       </xsl:copy>
   </xsl:template>



22Authors.xml contains:
<List>
   <Item>
<Heading entry="author"> Tabor, South Dakota. Chamber of Commerce </Heading>
       <Article>
           <Title>Czech days stamp cancellation</Title>
           <IssueName>May/Jun</IssueName>
           <Year>2007</Year>
           <Page>22</Page>
           <IssueNumber>3</IssueNumber>
       </Article>
       <Article>
           <Title>Czech days stamp cancellation</Title>
           <IssueName>May/Jun</IssueName>
           <Year>2008</Year>
           <Page>2</Page>
           <IssueNumber>3</IssueNumber>
           <Comment>
               <Article>
                   <Person>Dennis Povondra</Person>
                   <Title>Philatelic news and views</Title>
                   <IssueName>May/Jun</IssueName>
                   <IssueNumber>3</IssueNumber>
                   <Year>2008</Year>
                   <Page>27</Page>
               </Article>
           </Comment>
       </Article>
   </Item>
<!—many more items –>
</List

35Subjects.xml contains a similar set of items:
<List>
  <Item>
     <Heading id="A1" entry="subject"> Tábor, Bohemia</Heading>
     <Level1>
<SubDiv1 id="A1-2" catalog="1" scott-number="716" pofis-number="849">1955</SubDiv1>
        <Article>
           <Person>Bulletin of the Ministry of Posts</Person>
           <Title>New issues [Title varies or absent]</Title>
           <IssueName>Nov</IssueName>
           <IssueNumber>9</IssueNumber>
           <Year>1955</Year>
           <Page>134</Page>
        </Article>
     </Level1>
  </Item>
<!—many more items –>
</List>

Thanks,
Mark


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>