Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-386

Search fail in tree with normalize-space function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Invalid
    • 1.7
    • None
    • XPathC
    • None
    • Operating System: Windows NT/2K
      Platform: Other
    • 26661

    Description

      An example with tree files: bug_func.xml, bug_func.xsl, bug_func.txt
      You see the bug in "bug_func.txt".
      After, you have to see bug_func.xsl, bug_func.xml and look at the different
      search case.

      This algo is useful to make translation.

      Call:
      xalan -o bug_func.txt bug_func.xml bug_func.xsl

      bug_func.xml:
      <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>

      <A>
      <B/>
      <R1>
      <P><L l="d" t="d1"/><L l="f" t="f1"/><L l="e" t="e1"/></P>
      <P><L l="d" t="d2"/><L l="f" t="f2"/><L l="e" t="e2"/></P>
      </R1>
      <R2>
      <!-- change place of l="e" (3 => 2) -->
      <P><L l="d" t="d1"/><L l="e" t="e1"/><L l="f" t="f1"/></P>
      <P><L l="d" t="d2"/><L l="e" t="e2"/><L l="f" t="f2"/></P>
      </R2>
      <R3>
      <!-- change place of l="e" (2 => 1) -->
      <P><L l="e" t="e1"/><L l="d" t="d1"/><L l="f" t="f1"/></P>
      <P><L l="e" t="e2"/><L l="d" t="d2"/><L l="f" t="f2"/></P>
      </R3>
      </A>

      bug_func.xsl:
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

      <!-- Directives générales -->
      <xsl:strip-space elements="*"/>
      <xsl:output method="text" encoding="ISO-8859-1"/>

      <xsl:template match="B">
      <xsl:text>@cas R1.a Ok:"</xsl:text>
      <xsl:value-of select="/A/R1/P[L/@l='e' and L/@t=normalize-space( 'e1')]/L
      [@l='f']/@t"/>
      <xsl:text>"@cas R1.b not Ok (empty):"</xsl:text>
      <xsl:value-of select="/A/R1/P[L/@l='e' and normalize-space( L/@t)=normalize-
      space( 'e1')]/L[@l='f']/@t"/>
      <xsl:text>"@cas R2.a Ok:"</xsl:text>
      <xsl:value-of select="/A/R2/P[L/@l='e' and L/@t=normalize-space( 'e1')]/L
      [@l='f']/@t"/>
      <xsl:text>"@cas R2.b not Ok (empty):"</xsl:text>
      <xsl:value-of select="/A/R2/P[L/@l='e' and normalize-space( L/@t)=normalize-
      space( 'e1')]/L[@l='f']/@t"/>
      <xsl:text>"@cas R3.a Ok:"</xsl:text>
      <xsl:value-of select="/A/R3/P[L/@l='e' and L/@t=normalize-space( 'e1')]/L
      [@l='f']/@t"/>
      <xsl:text>"@cas R3.b Ok:"</xsl:text>
      <xsl:value-of select="/A/R3/P[L/@l='e' and normalize-space( L/@t)=normalize-
      space( 'e1')]/L[@l='f']/@t"/>
      <xsl:text>"@</xsl:text>
      </xsl:template>

      </xsl:stylesheet>

      bug_func.txt:
      @cas R1.a Ok:"f1"@cas R1.b not Ok (empty):""@cas R2.a Ok:"f1"@cas R2.b not Ok
      (empty):""@cas R3.a Ok:"f1"@cas R3.b Ok:"f1"@

      Attachments

        Activity

          People

            Unassigned Unassigned
            denis.eab2@laposte.net Denis Eab
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: