Write to error log using redirect:write

P

Petterson Mikael

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
 
J

Joe Kesselman

Petterson said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top