XSLT: merge glossentries for ditamap in one table
Posted: Wed Mar 27, 2019 1:45 pm
Hi,
I would like to merge all the glossterms en glossdef from my ditamap into a CALS table.
When I try to run I get an error message on this line:
<xsl:for-each select="collection(concat($folderURI, '?select=*.dita;recurse=yes'))/glossentry"> with this message:
collection(): failed to parse XML file file:/C:/DITA/XSLT/!glossary/glossary.dita: org.xml.sax.SAXParseException; systemId: file:/C:/DITA/XSLT/!glossary/glossary.dita; lineNumber: 16; columnNumber: 21; XML document structures must start and end within the same entity.
This is the complete code:
I created part of the XLST based on this topic of this forum: post50728.html?hilit=XSLT%20multiple%20file#p50728
I am new to XSLT. Anyone who can help me this issue?
Second question.
Currently the XSLT would run on all files in a certain folder. How can I change this to run via a transformation scenario on the selected ditamap.
Thanks a lot!
I would like to merge all the glossterms en glossdef from my ditamap into a CALS table.
When I try to run I get an error message on this line:
<xsl:for-each select="collection(concat($folderURI, '?select=*.dita;recurse=yes'))/glossentry"> with this message:
collection(): failed to parse XML file file:/C:/DITA/XSLT/!glossary/glossary.dita: org.xml.sax.SAXParseException; systemId: file:/C:/DITA/XSLT/!glossary/glossary.dita; lineNumber: 16; columnNumber: 21; XML document structures must start and end within the same entity.
This is the complete code:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template name="glossary_table" match="glossentry">
<xsl:result-document href="glossary.dita" doctype-public="-//OASIS//DTD DITA Topic//EN" doctype-system="topic.dtd" indent="yes">
<xsl:element name="topic" xml:lang="en-US" xml:id="glos">
<xsl:attribute name="id">glossary</xsl:attribute>
<xsl:element name="title"/>
<xsl:element name="body">
<xsl:element name="table">
<xsl:element name="tgroup">
<xsl:attribute name="cols">2</xsl:attribute>
<colspec colname="c1" colnum="1" colwidth="1*"/>
<colspec colname="c2" colnum="2" colwidth="1*"/>
<xsl:element name="thead">
<row>
<entry>Term</entry>
<entry>Description</entry>
</row>
</xsl:element>
<xsl:element name="tbody">
<xsl:variable name="folderURI" select="resolve-uri('.',base-uri())"/>
<xsl:for-each select="collection(concat($folderURI, '?select=*.dita;recurse=yes'))/glossentry">
<row>
<entry><xsl:value-of select="glossterm"/></entry>
<entry><xsl:value-of select="glossdef"/></entry>
</row>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>
I created part of the XLST based on this topic of this forum: post50728.html?hilit=XSLT%20multiple%20file#p50728
I am new to XSLT. Anyone who can help me this issue?
Second question.
Currently the XSLT would run on all files in a certain folder. How can I change this to run via a transformation scenario on the selected ditamap.
Thanks a lot!