RE: diagnostics use.

"Edvard Robertsson" <[email protected]> Thu, 22 Jan 2004 17:35:37 +0100
Newsgroups gmane.text.xml.schematron
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_7a3_7267_364b
Content-Type: text/plain; format=flowed

Hi Dave,

Your code looks ok so the most likely problem is that you use a schematron 
engine stylesheet that doesn't support diagnostics. The 
schematron-report.xsl engine supports diagnostics without modifications and 
I think schematron-message.xsl does as well.
However the schematron-basic.xsl does not support diagnostics without some 
modifications. I've attached a schematron-diagnose.xsl engine that basically 
is the same as schematron-basic.xsl but with support for diagnostics.

Cheers,
/Eddie

>Picking up Schematron 1.5, not having used it for some time.
>I'm looking for some guidance on the use of the diagnostics tag.
>
>I have
>
>   <pattern name="FeedLink" id="FeedLinkCheck">
>     <rule context="r:feed">
>       <assert test="r:link[@rel='alternate']"
>	      role="Feed/link check"
>       diagnostics="feedLink">Required link element with rel attribute
>       value of 'alternate' is missing.  4.4 states: atom:feed elements
>       MUST contain at least one atom:link element with a rel attribute
>       value of "alternate".
>       </assert>
>     </rule>
>   </pattern>
>
>and
>
>
>   <diagnostics>
>     <diagnostic id="auth1">Feed element has no author.  Neither do
>     entry children</diagnostic>
>
>     <diagnostic id="feedLink">4.4 states: atom:feed elements MUST
>     contain at least one atom:link element with a rel attribute value
>     of "alternate".
>     </diagnostic>
>   </diagnostics>
>
>But the diagnostics text isn't showing.
>   1.5 complexity has me scratching my head.
>
>Unsure which stylesheet to use,
>   params to pass in,
>   or new templates to write/modify.
>
>Any assistance appreciated.
>
>Regards DaveP.
>
>**** snip here *****
>
>-
>DISCLAIMER:
>
>NOTICE: The information contained in this email and any attachments is
>confidential and may be privileged. If you are not the intended
>recipient you should not use, disclose, distribute or copy any of the
>content of it or of any attachment; you are requested to notify the
>sender immediately of your receipt of the email and then to delete it
>and any attachments from your system.
>
>RNIB endeavours to ensure that emails and any attachments generated by
>its staff are free from viruses or other contaminants. However, it
>cannot accept any responsibility for any  such which are transmitted.
>We therefore recommend you scan all attachments.
>
>Please note that the statements and views expressed in this email and
>any attachments are those of the author and do not necessarily represent
>those of RNIB.
>
>RNIB Registered Charity Number: 226227
>
>Website: http://www.rnib.org.uk
>
>
>-------------------------------------------------------
>The SF.Net email is sponsored by EclipseCon 2004
>Premiere Conference on Open Tools Development and Integration
>See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
>http://www.eclipsecon.org/osdn
>_______________________________________________
>Schematron-love-in mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/schematron-love-in

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

------=_NextPart_000_7a3_7267_364b
Content-Type: text/xml; name="schematron-diagnose.xsl"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="schematron-diagnose.xsl"

<?xml version="1.0" ?>
<!-- Basic metastylesheet for the Schematron XML Schema Language.
	http://www.ascc.net/xml/resource/schematron/schematron.html

 Copyright (c) 2000,2001 Rick Jelliffe and Academia Sinica Computing Center, Taiwan

 This software is provided 'as-is', without any express or implied warranty. 
 In no event will the authors be held liable for any damages arising from 
 the use of this software.

 Permission is granted to anyone to use this software for any purpose, 
 including commercial applications, and to alter it and redistribute it freely,
 subject to the following restrictions:

 1. The origin of this software must not be misrepresented; you must not claim
 that you wrote the original software. If you use this software in a product, 
 an acknowledgment in the product documentation would be appreciated but is 
 not required.

 2. Altered source versions must be plainly marked as such, and must not be 
 misrepresented as being the original software.

 3. This notice may not be removed or altered from any source distribution.
-->

<!-- Schematron diagnose -->

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

<xsl:import href="skeleton1-5.xsl"/>
<xsl:param name="diagnose">yes</xsl:param>

<xsl:template name="process-prolog">
   <axsl:output method="text" />
</xsl:template>

<xsl:template name="process-root">
   <xsl:param name="title" />
   <xsl:param name="contents" />
   <xsl:value-of select="$title" />
   <xsl:text>&#10;</xsl:text>
   <xsl:copy-of select="$contents" />
</xsl:template>

<xsl:template name="process-pattern">
	<xsl:param name="name" />
	<xsl:text>&#10;</xsl:text>
	<xsl:text>&#10;</xsl:text>
        <xsl:text>From pattern "</xsl:text>
        <xsl:value-of select="$name" />
	<xsl:text>": </xsl:text>
</xsl:template>

<xsl:template name="process-assert">
	<xsl:param name="test" />
	<xsl:param name="role" />
	<xsl:param name="diagnostics" />
	
	<xsl:text>&#10;</xsl:text>
	<xsl:text>     Assertion fails: </xsl:text>
	<xsl:call-template name="process-message">
		<xsl:with-param name="pattern" select="$test"/>
		<xsl:with-param name="role" select="$role"/>
	</xsl:call-template>
	<xsl:text> </xsl:text>
	<xsl:if test="$diagnose = 'yes'">
		<xsl:call-template name="diagnosticsSplit">
             		<xsl:with-param name="str" select="$diagnostics"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<xsl:template name="process-report">
	<xsl:param name="test" />
	<xsl:param name="role" />
	<xsl:param name="diagnostics"/>

	<xsl:text>&#10;</xsl:text>
	<xsl:text>      Report: </xsl:text>
	<xsl:call-template name="process-message">
		<xsl:with-param name="pattern" select="$test"/>
		<xsl:with-param name="role" select="$role"/>
	</xsl:call-template>
	<xsl:text> </xsl:text>
	<xsl:if test="$diagnose = 'yes'">
		<xsl:call-template name="diagnosticsSplit">
             		<xsl:with-param name="str" select="$diagnostics"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>


<xsl:template name="process-message">
   <xsl:param name="pattern" />
   <xsl:param name="role" />
   <xsl:if test="$role">
      <xsl:text> (</xsl:text>
      <xsl:value-of select="$role" />
      <xsl:text>)</xsl:text>
   </xsl:if>"<xsl:apply-templates mode="text" />"  at 
         <axsl:apply-templates mode="schematron-get-full-path" select="." /> 
        &lt;<axsl:value-of select="name()"/><axsl:for-each select="@*"
		><axsl:value-of select="' '"/><axsl:value-of select="name()"
		/>="<axsl:value-of select="."/>"</axsl:for-each>&gt;...&lt;/&gt;</xsl:template>
     

</xsl:stylesheet>


------=_NextPart_000_7a3_7267_364b--


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn