ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22044] - style-task and undefined parameters
Date Tue, 05 Aug 2003 09:36:03 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22044>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22044

style-task and undefined parameters





------- Additional Comments From peter.reilly@corvil.com  2003-08-05 09:36 -------
Ok, in this case Jan's suggestion of an if attribute to "param" should be used.
I have attached a patch file that does this (a little bit of cut&paste from
the junit task).

- simplified test
<project name="test" basedir="." default="main">
    <target name="main">
        <property name="defined" value="This is a Defined."/>
        <style in="test.xml" style="test.xsl" out="out.xml">
            <param name="defined" expression="${defined}" if="defined"/>
            <param name="notdefined" expression="${notdefined}"
                   if="notdefined"/>
        </style>

        <!-- Prints the result -->
        <concat>
            <filelist dir="." files="out.xml"/>
        </concat>
    </target>
</project>

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- get the xsl-parameter -->
<xsl:param name="defined">defined default value</xsl:param>
<xsl:param name="notdefined">notdefined default value</xsl:param>

<!-- use the xsl-parameter -->
<xsl:template match="/">
defined: '<xsl:value-of select="$defined"/>'
notdefined: '<xsl:value-of select="$notdefined"/>'
</xsl:template>

</xsl:stylesheet>

-- Output:
main:
    [style] Processing /home/preilly/proj/learning/style/test.xml to
/home/preilly/proj/learning/style/out.xml
    [style] Loading stylesheet /home/preilly/proj/learning/style/test.xsl
   [concat] <?xml version="1.0" encoding="UTF-8"?>

   [concat] defined: 'This is a Defined.'
   [concat] notdefined: 'notdefined default value'

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message