xsl-list
[Top] [All Lists]

RE: using {} brackets with xsl:result-document href (Saxon 7.4)

2003-04-22 11:48:27
The href attribute of xsl:result document is an attribute value
template, not an XPath expression. If you write href="$x" that means you
want the URI to be "$x", if you write href="{$x}" that means you want
the URI to be whatever the value of variable x is.

If the value of the href attribute is a relative URI, it's interpreted
relative to the base URI of the principal output document. This is known
when you use the -o option on the Saxon command line, but is unknown if
you send the result to standard output.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
malcolm macaulay
Sent: 22 April 2003 15:50
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] using {} brackets with xsl:result-document 
href (Saxon 7.4)


Can someone please explain why I need to use {} bracket in 
the href of 
xsl:results-document?

I'm familiar with using {} as a shortcut for writing values 
into output 
attributes but I'm not sure why I can't do something like:

<xsl:result-document href="string($vFilePath) ...

Saxon (7.4) gives me the following error:

"the system identifier of the principal output file is unknown"

No doubt I totally misunderstand the {} :-)

Below are some examples of xsk:result-document which have confused me.

Thanks for your help.

cheers

Malcolm

XML:

<?xml version="1.0" encoding="UTF-8"?>
<filesToMake>
      <file path="c:/temp"/>
      <file path="c:/temp/temp"/>
</filesToMake>

XSLT:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="2.0">
      <!-- -->
      <xsl:variable name="fileSep" 
select="system-property('file.separator')"/>
      <!-- -->
      <xsl:template match="/">
              <xsl:apply-templates/>
      </xsl:template>
      <!--

      This works..

      <xsl:template match="file">
              <xsl:variable name="vFileName" select="concat( 
'file:///' , @path , 
$fileSep , 'test.xml' )"/>
              <xsl:result-document href="{$vFileName}"  >
                      <x>output..</x>
              </xsl:result-document>
      </xsl:template>
-->
      <!--

      This does not work.... Saxon says : The system 
identifier of the principal 
output file is unknown..

      <xsl:template match="file">
              <xsl:variable name="vFileName" select="concat( 
'file:///' , @path , 
$fileSep , 'test.xml' )"/>
              <xsl:result-document href="$vFileName"  >
                      <x>output..</x>
              </xsl:result-document>
      </xsl:template>-->
      <!--

      This works..

      <xsl:template match="file">

              <xsl:result-document 
href="{'file:///'}{(_at_)path}{$fileSep}{'test.xml'}"  >
                      <x>output..</x>
              </xsl:result-document>
      </xsl:template>
      -->
      <!--

      This does not work.... Saxon says : The system 
identifier of the principal 
output file is unknown..

      <xsl:template match="file">
              <xsl:variable name="vFileName" select="concat( 
'file:///' , @path , 
$fileSep , 'test.xml' )"/>
                <xsl:result-document href="string($vFileName)"  >
                        <x>output..</x>
                </xsl:result-document>
        </xsl:template>-->
        <!--

        This works...
        -->
        <xsl:template match="file">
                <xsl:result-document href="file:///{(_at_)path}\test(_dot_)xml" 

                        <x>output..</x>
                </xsl:result-document>
        </xsl:template>

        <!--

        This does not work.... Saxon says : The system identifier of the
principal 
output file is unknown..

        <xsl:template match="file">
                <xsl:result-document href="concat( 'file:///' , @path ,
$fileSep , 
'test.xml' )">
                        <x>output..</x>
                </xsl:result-document>
        </xsl:template>-->
</xsl:stylesheet>





_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>