- From: Costello, Roger L. <costello@mitre.org>
- Date: Mon, 15 Jun 2009 08:05:56 -0400
- To: "xproc-dev@w3.org" <xproc-dev@w3.org>
Hi Folk, One way to implement an XProc pipeline is to simply call XSLT (using p:xslt) and have a stylesheet do the work. Or, call Schematron to do the work. Alternatively, the work could be done using the basic XProc steps. What's best practice? Should the basic XProc steps be favored over escaping to XSLT or Schematron? EXAMPLE When processing an auto loan application it is necessary to determine if the applicant is underage. A person is underage depends on which (U.S.) state he/she resides in - in Alaska someone is underage if they are under 16 years of age, whereas in Ohio a person is underage if they are under 18 years of age. Determining whether an applicant is underage could be implemented using XSLT. It could be implemented using Schematron. And it could be implemented using the basic XProc steps. Here is an XSLT implementation: http://www.xfront.com/xproc/automated-decision-support/Is-Applicant-Underage.xsl Below is an implementation using the XProc steps. Suppose Fred creates an XProc pipeline for processing the loan application. When it comes time to determine if the applicant is underage he uses p:xslt to invoke an XSLT stylesheet that implements the "is underage" functionality. Suppose Sally also creates an XProc pipeline for processing the loan application. When it comes time to determine if the applicant is underage she uses the below user-defined XProc step to implement the "is underage" functionality. Which pipeline implementation is better - Fred's or Sally's? Why? /Roger *************************************************** User-Defined XProc Step to Determine if a Loan Applicant is Underage *************************************************** <p:declare-step type="applicant:is-underage" name="is-underage"> <p:input port="auto-loan-application" /> <p:output port="result"/> <p:choose> <p:variable name="state" select="Loan-Application/Applicant/Address/State" /> <p:variable name="age" select="Loan-Application/Applicant/Age" /> <p:when test="($state eq 'AK') and (number($age) le 16)"> <p:identity> <p:input port="source"> <p:inline><is-underage>true</is-underage></p:inline> </p:input> </p:identity> </p:when> <p:when test="($state eq 'AL') and (number($age) le 18)"> <p:identity> <p:input port="source"> <p:inline><is-underage>true</is-underage></p:inline> </p:input> </p:identity> </p:when> <p:when test="($state eq 'AZ') and (number($age) le 17)"> <p:identity> <p:input port="source"> <p:inline><is-underage>true</is-underage></p:inline> </p:input> </p:identity> </p:when> <!-- ... --> <p:when test="($state eq 'OH') and (number($age) le 18)"> <p:identity> <p:input port="source"> <p:inline><is-underage>true</is-underage></p:inline> </p:input> </p:identity> </p:when> <!-- ... --> <p:when test="($state eq 'WY') and (number($age) le 17)"> <p:identity> <p:input port="source"> <p:inline><is-underage>true</is-underage></p:inline> </p:input> </p:identity> </p:when> <p:otherwise> <p:identity> <p:input port="source"> <p:inline><is-underage>false</is-underage></p:inline> </p:input> </p:identity> </p:otherwise> </p:choose> </p:declare-step>
Received on Monday, 15 June 2009 12:06:29 UTC