Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glitch with null things in an object list. #9

Open
GoogleCodeExporter opened this issue Mar 19, 2015 · 0 comments
Open

Glitch with null things in an object list. #9

GoogleCodeExporter opened this issue Mar 19, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. If there's a null item at the end of an object list, the closing curly
brackets aren't reproduced exactly.
2. Also I find that the code to test the following items doesn't work
exactly right.  

<object>
  <thing> test </thing>
  <nullpart/>
</object>


What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Here's my new version. Note the tags at the end of each case:

 <!-- item:null -->
  <xsl:template match="*[count(child::node())=0]">
    <xsl:call-template name="indent"/>
    <xsl:call-template name="quote-property">
      <xsl:with-param name="name" select="local-name()"/>
    </xsl:call-template>
    <xsl:text>:null</xsl:text>
     <xsl:choose>
    <xsl:when   test="following-sibling::*">,</xsl:when>
    <xsl:otherwise >}</xsl:otherwise>
     </xsl:choose>
  </xsl:template>

  <!-- object -->
  <xsl:template match="*" name="base">
    <xsl:if test="not(preceding-sibling::*)">{</xsl:if>
    <xsl:call-template name="indent"/>
    <!-- JS: handle attributes -->
    <xsl:call-template name="attrs">
      <xsl:with-param name="attrs" select="../@*"/>
    </xsl:call-template>
    <xsl:call-template name="quote-property">
      <xsl:with-param name="name" select="name()"/>
    </xsl:call-template>
    <xsl:text>:</xsl:text>
    <xsl:apply-templates select="child::node()"/>
    <xsl:choose>
    <xsl:when   test="following-sibling::*">,</xsl:when>
    <xsl:otherwise >}</xsl:otherwise>
     </xsl:choose>
  </xsl:template>


  <!-- array -->
  <xsl:template match="*[count(../*[name(../*)=name(.)])=count(../*) and
count(../*)&gt;1]">
    <xsl:if test="not(preceding-sibling::*)">[</xsl:if>
    <xsl:call-template name="indent"/>
    <xsl:choose>
      <xsl:when test="not(child::node())">
        <xsl:text>null</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="child::node()"/>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:choose>
    <xsl:when   test="following-sibling::*">,</xsl:when>
    <xsl:otherwise >]</xsl:otherwise>
    </xsl:choose>
  </xsl:template>




Original issue reported on code.google.com by pway...@gmail.com on 17 Apr 2008 at 2:25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant