Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-41788

Passing parameters to templates with xsl:apply-templates does not work

    XMLWordPrintable

Details

    Description

      Parameters passed with xsl:apply-templates to templates does not work. Following codes work with online validator (http://xslttest.appspot.com/) but fail to work with QtXmlPatterns.

      This example should transform to text "Works". With QtXmlPatterns, result is only a string with empty lines.

      XML:

      <?xml version="1.0" encoding="UTF-8" ?>
      <?xml-stylesheet type="text/xsl" href="transform.xsl"?>
      <document>
        <items>
          <item/>
        </items>
        <start value="Works"/>
      </document>
      

      XSLT:

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:output method='html' version='5.0' encoding='UTF-8' indent='yes'/>
          <xsl:template match="/document/start">
              <xsl:apply-templates select="/document/items/*">
                  <xsl:with-param name="par" select="@value"/>
              </xsl:apply-templates>
          </xsl:template>
          <xsl:template match="item">
              <xsl:param name="par"/>
              <xsl:value-of select="$par"/>
          </xsl:template>
      </xsl:stylesheet>
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes