W3C home > Mailing lists > Public > xproc-dev@w3.org > January 2012

RE: Generating XSL / XProc

From: Philip Fennell <Philip.Fennell@marklogic.com>
Date: Wed, 4 Jan 2012 07:37:11 -0800
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <D20C296D14127D4EBD176AD949D8A75A20556AD9A3@EXCHG-BE.marklogic.com>
Zearin,

> I'm interested in learning how to use XML tools to generate XSL and/or XProc
> Any other general advice, comments, suggestions on this topic?

There's no great trick to this as they are both XML documents you are generating. If you are generating XSLT with XSLT then the thing that makes it a lot easier is the use of namespace aliases:

<xsl:transform
                              xmlns:c="http://www.w3.org/ns/xproc-step"
                              xmlns:err="http://www.w3.org/ns/xproc-error"
                              xmlns:hp="http://code.google.com/p/half-pipe/"
                              xmlns:p="http://www.w3.org/ns/xproc"
                              xmlns:saxon="http://saxon.sf.net/"
                              xmlns:xproc="http://www.w3.org/ns/xproc"
                              xmlns:xs="http://www.w3.org/2001/XMLSchema"
                              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:XSLT="http://www.w3.org/1999/XSL/Transform/output"
                              exclude-result-prefixes="c"
                              version="2.0">

               <xsl:namespace-alias stylesheet-prefix="XSLT" result-prefix="xsl"/>


               <!-- Creates input port parameters for step templates. -->
               <xsl:template match="p:input" mode="xproc:step-inputs">
                              <XSLT:param name="input-{@port}" as="element(){hp:sequenceQualifier(.)}" tunnel="yes"/>
               </xsl:template>


The above code fragment is taken from an XSLT transform that takes an XProc pipeline as input and generates an XSLT transform that 'implements' that pipeline. Note the declaration of the XSLT namespace prefix and its alias declaration. Where ever you want to generate an XSLT element in your result document you need to use the XSLT instead of the xsl prefix which is, of course, part of the transform that's generating the XSLT result document.


Regards

Philip



From: Zearin [mailto:zearin@gonk.net]
Sent: Wednesday, January 04, 2012 3:08 PM
To: XProc Dev
Subject: Generating XSL / XProc

I'm interested in learning how to use XML tools to generate XSL and/or XProc (code skeletons are just fine-anything extra is a delightful bonus).


 *   Are there documents that teach how to do this?
 *   Are there existing tools available for accomplishing this?
 *   Any other general advice, comments, suggestions on this topic?

Thanks!

-Zearin
    (Tony)
Received on Wednesday, 4 January 2012 15:37:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 4 January 2012 15:37:36 GMT