Write to error log using redirect:write

Discussion in 'XML' started by Petterson Mikael, Sep 11, 2006.

  1. Hi,

    I am using xalan. In my stylesheet I have the following snippet to write
    to std out when a specific error occurs.

    <xsl:template name="class_error">
    <xsl:param name="class"/>
    <xsl:param name="attribute"/>
    <xsl:param name="error_msg"/>
    <xsl:message terminate="no">
    Class:<xsl:value-of select="$class"/>
    Attribute:<xsl:value-of select="$attribute"/>
    Error:<xsl:value-of select="$error_msg"/>
    </xsl:message>
    </xsl:template>

    I want to collcet all these class errors in a file. I have tested to
    create an error.log in my outputdirectory using

    > <xsl:template name="class_error">
    > <xsl:param name="class"/>
    > <xsl:param name="attribute"/>
    > <xsl:param name="error_msg"/>
    > <redirect:write file="{$output.dir}/{$error.log}" append="true">
    > Class:<xsl:value-of select="$class"/>
    > Attribute:<xsl:value-of select="$attribute"/>
    > Error:<xsl:value-of select="$error_msg"/>
    > </redirect:write>
    > <redirect:close file="{$output.dir}/{$error.log}"/>
    > <xsl:message terminate="no">
    > Class:<xsl:value-of select="$class"/>
    > Attribute:<xsl:value-of select="$attribute"/>
    > Error:<xsl:value-of select="$error_msg"/>
    > </xsl:message>
    >
    > </xsl:template>



    But there is not error.log file created there. What am I missing or is
    there a better way to do it?

    cheers,

    //mikael
    Petterson Mikael, Sep 11, 2006
    #1
    1. Advertising

  2. Petterson Mikael wrote:
    >> <redirect:write file="{$output.dir}/{$error.log}" append="true">

    > But there is not error.log file created there. What am I missing or is
    > there a better way to do it?


    Stupid question, just to get it out of the way: You didn't show us what
    you set those variables to. Are they initialized correctly and in scope
    at this point in the stylesheet?


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Sep 11, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik_the_boss
    Replies:
    0
    Views:
    2,643
    Henrik_the_boss
    Nov 5, 2003
  2. Amratash
    Replies:
    0
    Views:
    515
    Amratash
    Apr 13, 2004
  3. unomystEz
    Replies:
    0
    Views:
    542
    unomystEz
    Nov 19, 2006
  4. Sal
    Replies:
    1
    Views:
    398
  5. Replies:
    0
    Views:
    1,285
Loading...

Share This Page