xsl-list
[Top] [All Lists]

FW: result-document output filename in context of for-each ?

2004-09-02 22:02:07
Got my head under the hood after an extended break, and I can't see the
problem for all the grease.
Any help is appreciated.

Want to get the value of contextual '@file' attribute as the output filename.
I could put the result-document command inside the for-each loop, but I would
lose results outside of that.


        <xsl:template name="navbar" match="link">
                <xsl:param name="active" select="position()"/>
                
<!--
-----------------------------------------------------------------------------
----------------------------------
Wanting to output the results of the template to new file for each node
addressed -->

                <xsl:result-document href="{ $fname }"> 

<!--
How can I access the value of the $fname variable in the context of the
for-each loop below ? 
-----------------------------------------------------------------------------
--------------------------------------- -->


                        <xsl:for-each
select="following-sibling::*|preceding-sibling::*|.">
                                
                                <xsl:variable name="fname">
                                        <xsl:call-template name="filename">
                                                <xsl:with-param name="x"
select="@file"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                
                                <tr><td class="nav"><xsl:element
name="ul"><xsl:element name="a">        <xsl:attribute name="href">

        
<xsl:value-of select="concat('NAV_',$fname)"/>

        
</xsl:attribute><xsl:attribute name="class">white</xsl:attribute>

                                                                <xsl:if
test="position()=$active">
        
<xsl:attribute
name="style"><xsl:text>;font-weight:bold</xsl:text></xsl:attribute>
</xsl:if>

                                                                <xsl:value-of
select="@name"/>

        
</xsl:element></xsl:element></td></tr>

                        </xsl:for-each>
                </xsl:result-document>
        
                <xsl:apply-templates select="link"/>

        </xsl:template>
</xsl:stylesheet>



Damian Clark
Web Developer, Application Support
Petroleum & Marine Division
Geoscience Australia
+61 2 6249 9336



<Prev in Thread] Current Thread [Next in Thread>
  • FW: result-document output filename in context of for-each ?, Damian.Clark <=