W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > October 2007

Re: Parametrized results in XSLT

From: Roland Gülle <roland@7val.com>
Date: Thu, 18 Oct 2007 15:43:16 +0200
Message-Id: <F917E772-14E5-45E5-AEFA-1F3DB6739363@7val.com>
Cc: public-mobileok-checker@w3.org
To: Dominique Hazael-Massieux <dom@w3.org>

> For instance, it would be nice to be able to:
>  * report which URI triggers errors with
> CONTENT_FORMAT_SUPPORT_AND_VALID_MARKUP, maybe completed with the mime
> type when relevant
>  * know the size of the page/of all the resources needed to load the
> page when getting an error in PAGE_SIZE
>
> Roland, how do you think we can best implement such a mechanism?
>  * have an additional parameter on the result template (e.g. "data" or
> "additionalInfo")
>  * have the messages in messages.properties.xml take parameters  
> directly
> through some syntax convention (e.g. $param1) and have the result
> template be  able to deal with those
>  * something else?
First question:
Are more dynamic infos needed,
or want we just to manipulate the messages?

If so, three solutions:
1.
Use the replace XST function with a regex:
<xsl:call-template name="result">
   <xsl:with-param name="search">PAGE_SIZE</xsl:with-param>
   <xsl:with-param name="replace">10000</xsl:with-param>
  ...
</xsl:call-template>
If the parameter search is filled, the "replace" [1]  function is  
used with the text from messages.properties.xml.

2.
The quick solution is define, one, two params, and use them also with  
a static replacement
$param1 is replaced with PLACEHOLDER_1
...

3.
If we want a pure XML/XSL solution, we could use:
<xsl:with-param name="args">
   <arg key="param1" value="value1"/>
   ...
</xsl:with-param>
This args will be transformed into a DOM with exslt.

Then we must change the messages:
<message id="...">FAIL: If the <param key="param1"/> ... </message>

No.3 is the most dynamic solution, No.2 the easiest.

Cheers,
  Roland

[1] http://www.w3.org/TR/xpath-functions/#regex-syntax
Received on Thursday, 18 October 2007 13:43:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:04 GMT