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

Merging dita files

Subject: Merging dita files
From: "Shailesh Shinde" <shailesh@xxxxxxxxxxxx>
Date: Tue, 5 Sep 2006 17:01:47 +0530
dita
Hi All,

I have to merge .dita file into one output.dita using xslt 2.0.

For the same I have "tecra.ditamap" which consists of attribute href which
have reference the files to be merge in the same sequence....


<topicref collection-type="family" type="chapter">
  <topicref href="2_introduction.dita" type="topic"/>
  <topicref href="3_the-grand-tour.dita" type="topic"/>
  <topicref href="4_getting-started.dita" type="topic"/>
  <topicref href="5_operating-basics.dita" type="topic"/>
  <topicref href="6_keyboard.dita" type="topic"/>
  <topicref href="7_power-and-power-up-modes.dita" type="topic"/>
  <topicref href="8_hw-setup.dita" type="topic"/>
  <topicref href="9_optional-devices.dita" type="topic"/>
  <topicref href="10_troubleshooting.dita" type="topic"/>
  <topicref href="11_disclaimers.dita" type="topic"/>
</topicref>

<topicref collection-type="family" type="appendix">
  <topicref href="12_appendix-A.dita" type="topic"/>
  <topicref href="13_appendix-B.dita" type="topic"/>
  <topicref href="14_appendix-C.dita" type="topic"/>
  <topicref href="15_appendix-D.dita" type="topic"/>
  <topicref href="16_appendix-E.dita" type="topic"/>
  <topicref href="17_appendix-F.dita" type="topic"/>
  <topicref href="18_appendix-G.dita" type="topic"/>
  <topicref href="19_appendix-H.dita" type="topic"/>
  <topicref href="20_appendix-I.dita" type="topic"/>
</topicref>


For the same I have done something like this........

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon">
	<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
	<xsl:output method="xml" indent="yes" name="xml"/>
	<xsl:strip-space elements="*"/>
	<xsl:template match="/">
			<book>
			<xsl:for-each
select="map/topicref[not(@type='glossary')]">
							<xsl:value-of
select="concat(substring-before(substring-after(@href,'/dita/'),'.'),'')"/>
					<xsl:apply-templates
select="document(@href)/dita"/>
					<xsl:apply-templates/>
		</xsl:for-each>

		<xsl:for-each
select="map/topicref[(@type='chapter')]/topicref">
					<xsl:value-of
select="concat(substring-before(substring-after(@href,'/dita/'),'.'),'')"/>
					<xsl:apply-templates
select="document(@href)/dita"/>
					<xsl:apply-templates/>
		</xsl:for-each>
		
		<xsl:for-each
select="map/topicref[(@type='appendix')]/topicref">
					<xsl:value-of
select="concat(substring-before(substring-after(@href,'/dita/'),'.'),'')"/>
					<xsl:apply-templates
select="document(@href)/dita"/>
					<xsl:apply-templates/>
		</xsl:for-each>
		
		<xsl:for-each select="map/topicref[(@type='glossary')]">
							<xsl:value-of
select="concat(substring-before(substring-after(@href,'/dita/'),'.'),'')"/>
					<xsl:apply-templates
select="document(@href)/dita"/>
					<xsl:apply-templates/>
		</xsl:for-each>
		
				<xsl:for-each
select="map/topicref[(@type='Index')]">
							<xsl:value-of
select="concat(substring-before(substring-after(@href,'/dita/'),'.'),'')"/>
					<xsl:apply-templates
select="document(@href)/dita"/>
					<xsl:apply-templates/>
		</xsl:for-each>
		
		</book>
	</xsl:template>

	<xsl:template match="dita">
		<xsl:copy-of select="."/>
	</xsl:template>
</xsl:stylesheet>


But I am not getting output for appendix as <dita type="appendix"> instead
of this I am getting <dita type="chapter">

Can you please tell me where it goes wrong.

Thanks,
Shailesh

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-2011 All Rights Reserved.