[Bug 18524] New: AVT in mode attribute for apply-templates

https://www.w3.org/Bugs/Public/show_bug.cgi?id=18524

           Summary: AVT in mode attribute for apply-templates
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
        AssignedTo: mike@saxonica.com
        ReportedBy: tolzidan@gmail.com
         QAContact: public-qt-comments@w3.org


At the moment mode in apply-templates is a token
(http://www.w3.org/TR/2007/REC-xslt20-20070123/#element-apply-templates,
http://www.w3.org/TR/2012/WD-xslt-30-20120710/#element-apply-templates). This
works for most use cases by leaves out a number of use cases having to to do
with secondary processing. It would be very useful if this could be an AVT to
allow for a secondary processor to further specify the format of an output.

An example usage might follow the following pipeline.

Run an xsl transform on document:
<?xml version="1.0" encoding="UTF-8"?>
<document>
  <element>some text</element>
</document>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
    xmlns:parser="parsernamespace"
    exclude-result-prefixes="xs"
    version="3.0">
    <xsl:param name="data" as="document-node()?"/>

    <xsl:template match="/document">
        <ouputitem path="/document/element" mode="myrendermode"/>
    </xsl:template>

    <xsl:template match="/outputitem">
        <html>
            <head>
                <title>A Page</title>
            </head>
            <body>
                <xsl:apply-templates select="." mode="rendercontents"/>
            </body>
        </html>

    </xsl:template>

    <xsl:template match="*" mode="rendercontents">
        <xsl:variable name="datapoint" select="parser:eval($data, concat('$p1',
@path))"/>
        <xsl:choose>
            <xsl:when test="@mode">
                <xsl:apply-templates select="$datapoint" mode="{@mode}"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$datapoint"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="*" mode="myrendermode">
        <p>
            <strong>element</strong>: <xsl:value-of select="."/>
        </p>
    </xsl:template>
</xsl:stylesheet>

Then run the same transform on the output from the template as the primary
document and the original document as the data xsl:param.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 10 August 2012 15:30:12 UTC