xsl-list
[Top] [All Lists]

Re: [xsl] Combining two files

2010-12-11 18:42:54
On 12/12/2010 00:31, Mark wrote:
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:

You haven't said what else you tried, so it's hard to tell you why it didn't work. Not sure what you mean by "without doubling one of them". If you don't want a dummy input file you can always change match="/*" on this template to name="main", and set -it:main on the command line. And delete the "* |" from the select, which doesn't seem to be doing anything useful.

Michael Kay
Saxonica


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>
--~--




--~------------------------------------------------------------------
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>