Changeset 208

Show
Ignore:
Timestamp:
02/05/07 13:14:19 (2 years ago)
Author:
nsteiner
Message:

stub:include now works without href for same document

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/experiments/general/xsl/parts.xml

    r206 r208  
    22<parts 
    33    xmlns:stub="http://stubbles.org/stub" 
     4    xmlns:xi="http://www.w3.org/2001/XInclude" 
    45    exclude-result-prefixes="stub"> 
    5   <part name="frank"> 
    6     <stub:include href="parts2.xml" part="nico"/> 
     6  <part name="frank">   
     7    <stub:include part="nico"/> 
    78  </part> 
    89  <part name="nico"> 
  • trunk/experiments/general/xsl/stub.xsl

    r206 r208  
    9191  <xsl:template match="stub:include" name="stub:include">     
    9292    <xsl:param name="href" select="@href"/> 
    93     <xsl:param name="part" select="@part"/>     
    94     <xi:include href="xinc://{$href}?part={$part}#xpointer(/parts/part[@name='{$part}']/node())"> 
     93    <xsl:param name="part" select="@part"/> 
     94    <xsl:variable name="xihref"> 
     95      <xsl:choose> 
     96        <xsl:when test="$href"> 
     97          <xsl:text>xinc://</xsl:text> 
     98          <xsl:value-of select="$href"/> 
     99          <xsl:text>?part=</xsl:text> 
     100          <xsl:value-of select="$part"/> 
     101          <xsl:text>#xpointer(/parts/part[@name='</xsl:text> 
     102          <xsl:value-of select="$part"/> 
     103          <xsl:text>']/node())</xsl:text> 
     104        </xsl:when> 
     105        <xsl:otherwise> 
     106          <xsl:text>#xpointer(/parts/part[@name='</xsl:text> 
     107          <xsl:value-of select="$part"/> 
     108          <xsl:text>']/node())</xsl:text> 
     109        </xsl:otherwise> 
     110      </xsl:choose> 
     111    </xsl:variable> 
     112    <xi:include href="{$xihref}"> 
    95113      <xi:fallback> 
    96114        ERROR: Could not include part <xsl:value-of select="$part"/> in file <xsl:value-of select="$href"/>