xsl-list
[Top] [All Lists]

[xsl] Re: fn:collection and result-document problem

2008-03-24 05:53:51
Hi,

Is there something about being inside a collection's context that makes
using result-document behave different? For example, I don't understand
why this works:
...
<xsl:variable name="jspx-files">
  <files>
    <xsl:for-each select="collection($jspx-includes-dir)">
      <file from="{document-uri(/)}" to="{concat($output-dir,
'/WEB-INF/jspx/', tokenize(document-uri(/), '/')[last()])}"/>
    </xsl:for-each>
  </files>
</xsl:variable>
<xsl:apply-templates select="$jspx-files/*" mode="output-jspx"/>
...

<xsl:template match="*" mode="output-jspx">
  <xsl:apply-templates mode="output-jspx-file"/>
</xsl:template>

<xsl:template match="*" mode="output-jspx-file">
  <xsl:message>
-----------------------------------------------------
JSPX from: <xsl:value-of select="@from"/>
JSPX to: <xsl:value-of select="@to"/>
  </xsl:message>
  <xsl:result-document href="{(_at_)to}">
    <xsl:apply-templates select="document(@from)/*"/>
  </xsl:result-document>
</xsl:template>



but this does not:

...
<xsl:apply-templates 
  select="collection($jspx-includes-dir)" 
  mode="jspx"/>
...
<xsl:template match="/" mode="jspx">
  <xsl:variable name="jspx-doc" select="."/>
  <xsl:variable name="page-path" 
    select="concat($output-dir, '/WEB-INF/jspx/',
tokenize(document-uri(/), '/')[last()])"/>
  <xsl:message>
JSPX: <xsl:value-of select="$page-path"/>:
  </xsl:message>
  <xsl:result-document href="{$page-path}">
    <xsl:apply-templates select="$jspx-doc"/>
  </xsl:result-document>
</xsl:template>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--