Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-1152

<xsl:for-each> iterates over phantom nodes.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 2.4Dx
    • None
    • Xalan
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 12090

    Description

      The XSL...

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <xsl:output method="text" encoding="utf-8"/>

      <xsl:template match="/">
      <xsl:apply-templates select="parent"/>
      </xsl:template>

      <xsl:template match="parent">
      <xsl:for-each select="child::node()">
      name is <xsl:value-of select="name()"/> text is <xsl:value-of select="text()"/>
      </xsl:for-each>
      </xsl:template>

      </xsl:stylesheet>

      Used with the XML...

      <?xml version="1.0" encoding="UTF-8"?>
      <parent>
      <a>1</a>
      <b>2</b>
      <c>3</c>
      <d>4</d>
      <e>5</e>
      </parent>

      generates...

      name is text is
      name is a text is 1
      name is text is
      name is b text is 2
      name is text is
      name is c text is 3
      name is text is
      name is d text is 4
      name is text is
      name is e text is 5
      name is text is

      Each real node is intersperced with two phantom empty nodes.

      Will attempt to look into this myself, just wondering if anyone has come across
      this.

      Thanks in advance.

      Attachments

        Activity

          People

            Unassigned Unassigned
            crowley_mark@yahoo.com Mark Crowley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: