[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-dev
Subject:    Re: [xml-dev] Rick Jelliffe's article on XSLT 1.0 performance
From:       Tony Graham <tgraham () antenna ! co ! jp>
Date:       2017-02-15 16:08:03
Message-ID: c7ab50a6-aea9-4204-6f24-c3188043b02f () antenna ! co ! jp
[Download RAW message or body]

On 15/02/2017 10:20, Tony Graham wrote:
> On 15/02/2017 09:57, Rick Jelliffe wrote:
> ...
>> For Schematron I am still not sure whether it would be better to have
>>
>> <sch:rule context="person">
>>    <sch:let name="payrate"  value="//rate[$for = current()/@class]"
>> as="xs:number"/>
>>
>> or
>>
>>
>> <sch:rule context="person">
>>    <sch:let name="payrate"  value="//rate[$for = current()/@class]"  />
>>
>>   <sch:assert tes"number(payrate)" >The payrate should be a
>> number</sch:assert>
>
> Presumably the second form is 'better' Schematron because it has a
> human-readable message. The separate test also means that you can do
> things like have separate messages if a value that should be an integer
> is a number but not an integer or is not a number at all.

Despite that, there's still use for sch:let/@as.

focheck [1] has hundreds of:

       <let name="expression" value="ahf:parser-runner(.)"/>

where ahf:parser-runner() is:

<!-- ahf:parser-runner($input as xs:string) as element()+ -->
<!-- Runs the REx-generated parser on $input then reduces the parse
      tree to a XSL 1.1 datatype.  Uses @saxon:memo-function extension
      to memorize return values (when used with Saxon PE or Saxon EE)
      to avoid reparsing the same strings again and again when this is
      used as part of validating an entire XSL-FO document. -->
<xsl:function name="ahf:parser-runner" as="element()+"
               saxon:memo-function="yes"
               xmlns:saxon="http://saxon.sf.net/" >
   <xsl:param name="input" as="xs:string" />

   ...
</xsl:function>

The result from 'ahf:parser-runner(.)' will only ever be 'element()+',
but this makes focheck run that tiny bit faster, then I'm all for it:

       <let name="expression" value="ahf:parser-runner(.)" as="element()+"/>

Regards,


Tony Graham.
-- 
Senior Architect
XML Division
Antenna House, Inc.
----
Skerries, Ireland
tgraham@antenna.co.jp


[1] https://github.com/AntennaHouse/focheck

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic