← all demos
xsl:stylesheet(
    version="1.0",
    xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias",
    xmlns:iso="http://purl.oclc.org/dsdl/schematron",
    xmlns:schold="http://www.ascc.net/xml/schematron",
    xmlns:svrl="http://purl.oclc.org/dsdl/svrl",
    xmlns:xs="http://www.w3.org/2001/XMLSchema",
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform")
  xsl:import(href="iso_schematron_skeleton_for_xslt1.xsl")
  param diagnose := true
  param phase :=
    choose:
      when //schold:schema/@defaultPhase:
        <- //schold:schema/@defaultPhase
      when //iso:schema/@defaultPhase:
        <- //iso:schema/@defaultPhase
      else:
        "#ALL"
  param allow-foreign := false
  param generate-paths := true
  param generate-fired-rule := true
  param optimize
  param output-encoding
  param sch.exslt.imports
  svrlTest := true()
  template process-prolog:
    axsl:output(indent="yes", method="xml", omit-xml-declaration="no", standalone="yes")
      if  string-length($output-encoding) > 0:
        @encoding
          <-  $output-encoding
  template process-root:
    param title
    param contents
    param queryBinding := xslt1
    param schemaVersion
    param id
    param version
    param fpi
    param icon
    param lang
    param see
    param space
    svrl:schematron-output(schemaVersion="{$schemaVersion}", title="{$title}")
      if  string-length( normalize-space( $phase )) > 0 and 
		not( normalize-space( $phase ) = '#ALL') :
        axsl:attribute(name="phase")
          <-  $phase 
      if  $allow-foreign = 'true':
      if  $allow-foreign = 'true':
        call richParms:
          fpi := $fpi
          icon := $icon
          lang := $lang
          see := $see
          space := $space
      axsl:comment
        axsl:value-of(select="$archiveDirParameter")
        axsl:value-of(select="$archiveNameParameter")
        axsl:value-of(select="$fileNameParameter")
        axsl:value-of(select="$fileDirParameter")
      apply
      copy $contents
  template process-assert(test, diagnostics, id, flag, role, subject, fpi, icon, lang, see, space):
    svrl:failed-assert(test="{$test}")
      if string-length( $id ) > 0:
        axsl:attribute(name="id")
          <-  $id 
      if  string-length( $flag ) > 0:
        axsl:attribute(name="flag")
          <-  $flag 
      call richParms:
        fpi := $fpi
        icon := $icon
        lang := $lang
        see := $see
        space := $space
      call linkableParms:
        role := $role
        subject := $subject
      if  $generate-paths = 'true' or $generate-paths= 'yes' :
        axsl:attribute(name="location")
          axsl:apply-templates(mode="schematron-get-full-path", select=".")
      svrl:text
        apply
      if $diagnose = 'yes' or $diagnose= 'true' :
        call diagnosticsSplit:
          str := $diagnostics
    if  $terminate = 'yes' or $terminate = 'true' :
      axsl:message(terminate="yes") = TERMINATING
    if  $terminate = 'assert' :
      axsl:message(terminate="yes") = TERMINATING
  template process-report(id, test, diagnostics, flag, role, subject, fpi, icon, lang, see, space):
    svrl:successful-report(test="{$test}")
      if  string-length( $id ) > 0:
        axsl:attribute(name="id")
          <-  $id 
      if  string-length( $flag ) > 0:
        axsl:attribute(name="flag")
          <-  $flag 
      call richParms:
        fpi := $fpi
        icon := $icon
        lang := $lang
        see := $see
        space := $space
      call linkableParms:
        role := $role
        subject := $subject
      if  $generate-paths = 'yes' or $generate-paths = 'true' :
        axsl:attribute(name="location")
          axsl:apply-templates(mode="schematron-get-full-path", select=".")
      svrl:text
        apply
      if $diagnose = 'yes' or $diagnose='true' :
        call diagnosticsSplit:
          str := $diagnostics
    if  $terminate = 'yes' or $terminate = 'true' :
      axsl:message(terminate="yes") = TERMINATING
  template process-dir(value):
    choose:
      when  $allow-foreign = 'true':
        copy .
      else:
        axsl:text
        apply
        axsl:text
  template process-diagnostic(id, fpi, icon, lang, see, space):
    svrl:diagnostic-reference(diagnostic="{$id}")
      call richParms:
        fpi := $fpi
        icon := $icon
        lang := $lang
        see := $see
        space := $space
      apply
  template process-emph(class):
    choose:
      when  $allow-foreign = 'true':
        copy .
      else:
        axsl:text
        apply
        axsl:text
  template process-rule(id, context, flag, role, subject, fpi, icon, lang, see, space):
    if  $generate-fired-rule = 'true':
      svrl:fired-rule(context="{$context}")
        call richParms:
          fpi := $fpi
          icon := $icon
          lang := $lang
          see := $see
          space := $space
        if  string( $id ):
          @id
            <-  $id 
        if  string-length( $role ) > 0:
          @role
            <-  $role 
  template process-ns(prefix, uri):
    svrl:ns-prefix-in-attribute-values(prefix="{$prefix}", uri="{$uri}")
  template process-p(icon, class, id, lang):
    svrl:text
      apply
  template process-pattern(name, id, is-a, fpi, icon, lang, see, space):
    svrl:active-pattern
      if  string( $id ):
        axsl:attribute(name="id")
          <-  $id 
      if  string( $name ):
        axsl:attribute(name="name")
          <-  $name 
      call richParms:
        fpi := $fpi
        icon := $icon
        lang := $lang
        see := $see
        space := $space
      apply
      axsl:apply-templates
  template process-message(pattern, role):
  template process-span(class):
    choose:
      when  $allow-foreign = 'true':
        copy .
      else:
        axsl:text
        apply
        axsl:text
  template richParms(fpi, icon, lang, see, space):
    if  $allow-foreign = 'true':
      if string($fpi):
        axsl:attribute(name="fpi")
          <- $fpi
      if string($icon):
        axsl:attribute(name="icon")
          <- $icon
      if string($see):
        axsl:attribute(name="see")
          <- $see
    if string($space):
      axsl:attribute(name="xml:space")
        <- $space
    if string($lang):
      axsl:attribute(name="xml:lang")
        <- $lang
  template linkableParms(role, subject):
    if  string($role ):
      axsl:attribute(name="role")
        <-  $role