Copy output XML files to multiple folders
Post here questions and problems related to editing and publishing DITA content.
Copy output XML files to multiple folders
Hello,
I am struggling with the following issue, which is that I need to be able to output XML files to multiple folders based on the XML filename using XSLT.
All files with names starting with B should go to one folder, files starting go to another folder and so on..
I have the following XSLT and it works fine to generate the needed files, but I am not able to output to multiple folders, which is what I need.
I am struggling with the following issue, which is that I need to be able to output XML files to multiple folders based on the XML filename using XSLT.
All files with names starting with B should go to one folder, files starting go to another folder and so on..
I have the following XSLT and it works fine to generate the needed files, but I am not able to output to multiple folders, which is what I need.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/">
<xsl:output method="xml" doctype-public="-//OASIS//DTD DITA Glossary//EN"
doctype-system="glossary.dtd" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="title"/>
<xsl:param name="files"
select="collection('../../../DITA/?select=%5BA-Z%2D%27%20%28%29%2C%5D%7B2,%7D.dita;recurse=yes')"/>
<xsl:template match="node()">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="$files//topic">
<xsl:value-of select="text()" disable-output-escaping="yes"/>
<xsl:result-document href="DITA/glossentries_all/{title/text()|title/b/text()}.dita">
<glossentry id="{concat('dita', generate-id())}">
<glossterm id="{concat('my_title', generate-id())}">
<xsl:value-of select="title"/>
</glossterm>
<glossdef>
<xsl:for-each select="body">
<xsl:apply-templates/>
</xsl:for-each>
<shortdesc/>
</glossdef>
</glossentry>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Re: Copy output XML files to multiple folders
I got the files to be copied to multiple folders just as I wanted by using the following line of code, suggested by Michael Kay: as shown http://p2p.wrox.com/xslt/90410-copy-out ... st292220">
Code: Select all
<xsl:result-document href="DITA/glossentries_all/{substring(title,1,1)}/{title/text()|title/b/text()}.dita">
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service