[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Chunking xml into single-topic docs
I'm taking documents that are authored in FrameMaker, converting them into structured xml files and then using an XSLT to transform them into DTD compliant single-topic xml documents. The problem I'm having is that the single-topic files that are created take the first word of the heading of each section and that is the file name for the xml file. However, if the first word is the same in more than one heading (i.e. Product Overview, and Product Specifications) the first file is overwritten by the second occurrence and the first file isn't created. As a newbie (frantically trying to learn xsl, Xpath, etc. as quickly as possible), I'm struggling with knowing where to start in fixing the problem. I was hoping any of you could point me in the right direction. Any help would be much appreciated. Thanks - Marcy Here is a section of the common.xsl file that I think needs to be changed: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" escape-uri-attributes="no" omit-xml-declaration="no" encoding="UTF-8" indent="yes" doctype-system="c:/Conversion/Tool/dtds/c_support_doc.dtd"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> <xsl:apply-templates select="NoName"/> </xsl:template> <xsl:variable name="chap.title" select="//ChapTitle"/> <xsl:template match="NoName"> <xsl:for-each-group select="*[not(following-sibling::ChTOC1) and not(following-sibling::ChTOC2) and not(self::ChTOC2) and not(self::ChTOC1) and not(following-sibling::ChapTOC1) and not(following-sibling::ChapTOC2) and not(self::ChapTOC2) and not(self::ChapTOC1) and not(self::TableAnchor[not(child::*)]) and not(self::ChapNum) and not(self::ChapTitle) and not(self::Cross-Ref)]" group-starting-with="OneHead"> <xsl:variable name="file_title"> <xsl:value-of select="translate(normalize-space(.),' ','_')"/> </xsl:variable> <xsl:variable name="title"> <xsl:choose> <xsl:when test="contains($file_title,'_')"> <xsl:value-of select="escape-uri(substring-before($file_title,'_'),true())"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="escape-uri($file_title,true())"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="title2"> <xsl:choose> <xsl:when test="contains($title,' ')"> <xsl:value-of select="substring-before($title,' ')"/> <xsl:text>.xml</xsl:text> </xsl:when> <xsl:when test="contains($title,'/')"> <xsl:value-of select="substring-before($title,'/')"/> <xsl:text>.xml</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="$title"/> <xsl:text>.xml</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="title3"> <xsl:value-of select="translate($file_title,'_',' ')"/> </xsl:variable> <xsl:result-document href="{$title2}"> <c_support_doc> <title> <xsl:value-of select="$title3"/> </title> <short.title> <xsl:value-of select="$title3"/> </short.title> <generic> <section> <xsl:call-template name="addId"/> <xsl:if test="current-group()[1][self::Note]"> <para> <note> <para> <xsl:value-of select="current-group()[self::Note][1]"/> </para> </note> </para> </xsl:if> <xsl:if test="current-group()[1][self::BodyText]"> <para> <xsl:value-of select="current-group()[self::BodyText][1]"/> </para> </xsl:if> <xsl:if test="current-group()[1][self::Body]"> <para> <xsl:value-of select="current-group()[self::Body][1]"/> </para> </xsl:if> <xsl:apply-templates select="current-group()[self::OneHead]" /> <xsl:for-each-group select="current-group() except ." group-starting-with="TwoHead"> <xsl:choose> <xsl:when test="self::TwoHead"> <section> <xsl:call-template name="addId"/> <xsl:apply-templates select="current-group()[self::TwoHead]"/> <xsl:for-each-group select="current-group() except ." group-starting-with="ThreeHead"> <xsl:choose> <xsl:when test="self::ThreeHead"> <section> <xsl:call-template name="addId"/> <xsl:apply-templates select="current-group()[self::*]"/> </section> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()[self::*]"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </section> </xsl:when> <xsl:otherwise> <xsl:for-each-group select="current-group()" group-starting-with="ThreeHead"> <xsl:choose> <xsl:when test="self::ThreeHead"> <section> <xsl:call-template name="addId"/> <xsl:apply-templates select="current-group()[self::*]"/> </section> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()[self::*]"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </section> </generic> </c_support_doc> </xsl:result-document> </xsl:for-each-group> </xsl:template>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|