|
Subject: Re: [xsl] outputting to original destination from within a result-document From: Sara Mitchell <samitchell6@xxxxxxxxx> Date: Tue, 20 Jun 2006 10:58:25 -0700 (PDT) |
Well, I'm not sure what you're input looks like, but
I have a stylesheet that takes a DITA file (with
several topics or concepts that could be nested) and
1) creates a map and 2) spits out a separate file for
each topic level element.
This is similar to your problem, but you will have to
substitute your own input. However, I'm using XSLT 1.0
-- so the syntax below is somewhat different. It
basically consists of these templates and a parameter
that specifies the name for the map file:
<xsl:param name="map-name"/>
<xsl:template match="/">
<!-- creates the map file -->
<xsl:call-template name="structure-map"/>
<!-- do chunking -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="topic">
<!-- could be concept, reference or task. Uses an
extension element to output to a separate file.
You would just use the XSLT element instead. -->
<xlnr:write file="tempTopic.xml"
select="concat('xml/', @id, '.xml')">
<!-- copies the content -- you would do whatever
you need to do to create DITA content from your
source -->
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xlnr:write>
</xsl:template>
<!-- identity transformation template to copy all the
DITA elements and attributes under 'topic' elements
-->
<!-- to create the map -->
<xsl:template name="structure-map">
<xlnr:write file="tempMap.xml"
select="concat('xml/', $map-name, 'Map.xml')">
<map>
<xsl:for-each select="/dita/topic |
/dita/concept | /topic | /concept">
<xsl:call-template name="topic-ref"/>
</xsl:for-each>
</map>
</xlnr:write>
</xsl:template>
<xsl:template name="topic-ref">
<topicref href="{concat(@id, '.xml')}">
<xsl:for-each select="topic | concept">
<xsl:call-template name="topic-ref"/>
</xsl:for-each>
</topicref>
</xsl:template>
--- Jeff Rosler <Jeff.Rosler@xxxxxxxxxxxxxxxxxxxxxx>
wrote:
> Hi All,
>
> I am using <xsl:result-document> in my stylesheet
> (processing with Saxon
> 8.7). I'd like to output back to my original output
> document from within
> the <xsl:result-document>. Does anyone know of any
> way to do this? Right
> now, I'm assuming I'll just have to do post
> processing with a second
> stylesheet, but I thought I'd post to see if anyone
> has any good ideas.
>
> My stylesheet is converting a single monolithic XML
> file to a DITA map
> file and also chunking out the content into separate
> DITA topic files
> (using <xsl:result-document>). This is a fine
> approach, but it doesn't
> handle nested sections in my monolithic XML file.
> When I get to a nested
> section (when I'm inside the <xsl:result-document>),
> I need to create
> another topic (new result document), but I also need
> to add a nested
> <topicref> to the DITA map file (original output
> document). I was trying
> to do this in a single XSL (creating the map file
> and doing the
> chunking), but now I think I need to fall back to
> two separate
> stylesheets; one to create the map and one to do the
> topic chunking.
>
> Can anyone answer my first question or have any
> other suggestions?
>
> Thanks for any and all responses,
>
> Jeff Rosler
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] outputting to original destin, Jeff Rosler | Thread | RE: [xsl] outputting to original de, Michael Kay |
| Re: [xsl] Convert XML to Excel usin, CyberSpace Industrie | Date | [xsl] Excluding content in an eleme, Chad Chelius |
| Month |