tags:

views:

33

answers:

1

Hi Everybody,

I have a problem with passing arguments from the NAnt style task to a xslt sheet. This is my NAnt code snippet. The properties path and file are definetly set.

<style style="${xslt.file}" extension="xml" in="${xml.file}" destdir=".">
    <parameters>
         <parameter name="path" value="${path}" 
                    namespaceuri="http://www.w3.org/1999/XSL/Transform" />
         <parameter name="doc" value="${file}" 
                    namespaceuri="http://www.w3.org/1999/XSL/Transform" />
    </parameters>
</style>

My Parameter are declared as following:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:ms="http://schemas.microsoft.com/developer/msbuild/2003"&gt;

<xsl:param name="path"></xsl:param>
<xsl:param name="file" />

And accessed by:

<xsl:value-of select="$path" />
<xsl:value-of select="$file" />

But when the file is transformed, $path and $file are both empty. I have tried with and without the namespaceuri of the style task.
What I am doing wrong?

Thanking you in anticipation.

A: 

Hmmm, why do you set $file and use $doc ?

BTW, here is a working example:

<style style="web.config.xsl" in="web.config.xsl" out="web.config">
 <parameters>
  <parameter name="OSVersion" value="${OSVersion}"/>
 </parameters>
</style>

and the XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
 <xsl:param name="OSVersion"/>
 <xsl:template match="/">
  <xsl:value-of select="$OSVersion"/>
 </xsl:template>
</xsl:stylesheet>
jcmeyrignac
I tried it another time with having minor changes to my code. I initialized the '<xsl:param name="path">PATH</xsl:param>' and it works. No idea why, but your are the only one who has answered my question you get the accepted mark :-)
Dennis