Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Write to error log using redirect:write

 
Thread Tools Search this Thread
Old 09-11-2006, 09:40 AM   #1
Default Write to error log using redirect:write


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">
<xslaram name="class"/>
<xslaram name="attribute"/>
<xslaram 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">
> <xslaram name="class"/>
> <xslaram name="attribute"/>
> <xslaram 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
  Reply With Quote
Old 09-11-2006, 01:06 PM   #2
Joe Kesselman
 
Posts: n/a
Default Re: Write to error log using redirect:write

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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump