You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dm...@apache.org on 2001/06/22 23:41:24 UTC

cvs commit: xml-xalan/test/tests/conf/idkey/err idkeyerr21.xml idkeyerr21.xsl

dmarston    01/06/22 14:41:24

  Added:       test/tests/conf/idkey/err idkeyerr21.xml idkeyerr21.xsl
  Log:
  New error case: id($var) is illegal in a match pattern
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/conf/idkey/err/idkeyerr21.xml
  
  Index: idkeyerr21.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- Test for ID selection and pattern matching -->
  <!DOCTYPE doc [
    <!ELEMENT doc (#PCDATA|a|b|c)*>
    <!ATTLIST doc id ID #REQUIRED>
    <!ELEMENT a (#PCDATA|a|b|c)*>
    <!ATTLIST a id ID #REQUIRED>
    <!ELEMENT b (#PCDATA|a|b|c)*>
    <!ATTLIST b id ID #REQUIRED>
    <!ELEMENT c (#PCDATA|a|b|c)*>
    <!ATTLIST c id ID #REQUIRED >
  ]>
  <doc id="id0">
    <a id="id1">
      *id1*
      <a id="id2">*id2*
        <a id="id3">*id3*</a>
        <b id="id4">*id4*</b>
        <c id="id5">*id5*</c>
      </a>
      <b id="id6">*id6*</b>
      <c id="id7">*id7*</c>
    </a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/idkey/err/idkeyerr21.xsl
  
  Index: idkeyerr21.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: idkeyerr21 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 5.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Use variable in id() argument in match pattern -->
    <!-- ExpectedException: Argument to id() in match pattern must be a literal string -->
  
  <xsl:strip-space elements="a b c"/>
  
  <xsl:variable name="pick" select="'id2'"/>
  
  <xsl:template match="/">
    <out>
      <xsl:apply-templates select="doc/a//text()"/>
      <xsl:text>&#10;</xsl:text>
    </out>
  </xsl:template>
  
  <xsl:template match="id($pick)//text()">
    <xsl:text>&#10;</xsl:text>
    <x><xsl:value-of select="../@id"/></x>
  </xsl:template>
  
  <xsl:template match="text()">
    <xsl:text>&#10;</xsl:text>
    <other><xsl:value-of select="."/></other>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org