2011-03-07 7 views
1

프로그램 작성 중에 웹 인터페이스의 일부가 XML로 클라이언트에 전송되고 Javascript와 XSLT를 사용하여 HTML 조각으로 변환됩니다. 이것은 파이어 폭스 (4.0b12)와 오페라 (10.63)에서 잘 작동하지만 크롬 (9.0.597.107)에서는 예상대로 결과가 나오지 않습니다.Chrome의 XSLT에서 예기치 않은 결과가 발생했습니다.

XSLT

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output method="html" indent ="yes"/> 
    <xsl:template match ="/"> 
    <xsl:for-each select="queue/download"> 
     <xsl:choose> 
     <xsl:when test="status='downloadError'"> 
      <xsl:variable name="rowClass">ui-state-error</xsl:variable> 
      <xsl:variable name="iconClass">ui-icon ui-icon-alert</xsl:variable> 
      <xsl:call-template name="download"> 
      <xsl:with-param name="iconClass" select="$iconClass"/> 
      <xsl:with-param name="rowClass" select ="$rowClass"/> 
      </xsl:call-template> 
     </xsl:when> 
     <xsl:when test="status='downloadRunning'"> 
      <xsl:variable name="rowClass">ui-state-highlight</xsl:variable> 
      <xsl:variable name="iconClass">ui-icon ui-icon-refresh</xsl:variable> 
      <xsl:call-template name="download"> 
      <xsl:with-param name="iconClass" select="$iconClass"/> 
      <xsl:with-param name="rowClass" select ="$rowClass"/> 
      </xsl:call-template> 
     </xsl:when> 
     <xsl:when test="status='downloadComplete'"> 
      <xsl:variable name="rowClass">downloadComplete</xsl:variable> 
      <xsl:variable name="iconClass">ui-icon ui-icon-circle-check</xsl:variable> 
      <xsl:call-template name="download"> 
      <xsl:with-param name="iconClass" select="$iconClass"/> 
      <xsl:with-param name="rowClass" select ="$rowClass"/> 
      </xsl:call-template> 
     </xsl:when> 
     <xsl:otherwise> 
      <xsl:variable name="rowClass" select ="status" /> 
      <xsl:variable name="iconClass"/> 
      <xsl:call-template name="download"> 
      <xsl:with-param name="iconClass" select="$iconClass"/> 
      <xsl:with-param name="rowClass" select ="$rowClass"/> 
      </xsl:call-template> 
     </xsl:otherwise> 
     </xsl:choose> 

    </xsl:for-each> 
    </xsl:template> 

    <xsl:template name="download"> 
    <xsl:param name="rowClass"/> 
    <xsl:param name="iconClass" /> 
    <xsl:variable name="id" select ="id"/> 
    <xsl:variable name="filename" select ="filename"/> 
    <xsl:variable name="comment" select ="comment"/> 
    <tr class="{$rowClass}"> 
     <td class="downloadCheck"> 
     <input type="checkbox" class="downloadCheckbox" value="{$id}" name="downloadCheckbox"/> 
     </td> 
     <td class="downloadIcon"> 
     <span class="{$iconClass}"></span> 
     </td> 
     <td class="downloadName"> 
     <a href="#" onclick="showDownloadCommentBox('{$id}','{$filename}', '{$comment}');"> 
      <xsl:value-of select="filename"/> 
     </a> 
     </td> 
     <xsl:if test="status='downloadError'"> 
     <td class="dError" colspan="4"> 
      <xsl:value-of select ="errortext"/> 
     </td> 
     </xsl:if> 
     <xsl:if test ="status!='downloadError'"> 
     <xsl:variable name="progress" select ="progress"/> 
     <td class="downloadProgress"> 
      <div class="jqProgress" value="{$progress}"></div> 
     </td> 
     <td class="downloadTimeLeft"> 
      <xsl:value-of select ="timeremaining"/> 
     </td> 
     <td class="downloadSize"> 
      <xsl:value-of select ="size"/> 
     </td> 
     <td class="downloadSpeed"> 
      <xsl:value-of select ="speed"/> 
     </td> 
     </xsl:if> 
    </tr> 
    </xsl:template> 
</xsl:stylesheet> 

는 XML

<queue> 
    <name>test</name> 
    <renderer>downloadQueue</renderer> 
    <xsl>/xslt/downloadQueue.xslt</xsl> 
    <status>suspended</status> 
    <startMode>manual</startMode> 
    <downloadDirectory>C:\Users\William\Programming\SCRAMDownloader\Trunk\bin\</downloadDirectory> 
    <download> 
     <filename>test.zip</filename> 
     <progress>0.00%</progress> 
     <speed>-</speed> 
     <timeremaining>-</timeremaining> 
     <status>downloadSuspended</status> 
     <size>119.68 MB</size> 
     <id>8976170e-1f4b-4b79-8901-5a4191e2c07d</id> 
     <comment/> 
    </download> 
</queue> 

예상 결과 (파이어 폭스)

<input type="checkbox" class="downloadCheckbox" value="8976170e-1f4b-4b79-8901-5a4191e2c07d" name="downloadCheckbox"> 
<span class=""></span> 
<a href="#" onclick="showDownloadCommentBox('8976170e-1f4b-4b79-8901-5a4191e2c07d','test.zip', '');">test.zip</a> 
<div class="jqProgress ui-progressbar ui-widget ui-widget-content ui-corner-all" value="0.00%" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="ui-progressbar-value ui-widget-header ui-corner-left" style="width: 0%; "></div></div> 
- 
119.68 MB 
- 
크롬

에서

<tr class="downloadSuspended"> 
    <td class="downloadCheck"><input type="checkbox" class="downloadCheckbox" value="8976170e-1f4b-4b79-8901-5a4191e2c07d" name="downloadCheckbox"></td> 
    <td class="downloadIcon"><span class=""></span></td> 
    <td class="downloadName"><a href="#" onclick="showDownloadCommentBox('8976170e-1f4b-4b79-8901-5a4191e2c07d','test.zip', '');">test.zip</a></td> 
    <td class="downloadProgress"><div class="jqProgress ui-progressbar ui-widget ui-widget-content ui-corner-all" value="0.00%" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="ui-progressbar-value ui-widget-header ui-corner-left" style="width: 0%;"></div></div></td> 
    <td class="downloadTimeLeft">-</td> 
    <td class="downloadSize">119.68 MB</td> 
    <td class="downloadSpeed">-</td> 
</tr> 

결과

누락 된 참고 사항 <tr><td> 태그

어떤 아이디어가 잘못 되었습니까? 잘못하고 어떤 메신저 (지나치게 긴 게시물에 대한 사과)

+0

... 당신이 필요하지 않은 경우

당신은 다음 결과에서 태그를 제거 할 수 있습니다 (... 나를 위해 작동) 문제가 해결 될 것이라고 생각 좋은 질문입니다, +1. 내 대답을보고 문제가 Google 크롬인지 확인합니다. 코드는 아닙니다. :) –

답변

1

어떤 아이디어?

아마도 (구글 크롬 사용이든) 버기 XSLT 프로세서를 이용하는 것 이외에는 아무것도.

난 9 다른 XSLT (1.0 및 2.0) 프로세서 모두의 결과 다음과 같은 것이 올바른지에이 변환을 시험했다 :

  • MSXML 3,4,6-

  • ALtova을 (XML의 SPY)

  • .NET (XslCompiledTransform과 된 XslTransform)

  • 색슨 (6.5.4 및 9.1.05)

  • XQSharp

+0

고마워요. 아픈 것 같습니다 크롬에 버그를보고 – insertjokehere

+0

@insertjokehere : 당신은 오신 것을 환영합니다. –

+0

누구든지 관심이있는 경우 [여기] (http://code.google.com/p/chromium/issues/detail?id=75110) – insertjokehere

0

난 그냥 같은 문제가 있었다. 문제는 크롬이 xslt 구문 분석의 출력을 확인하고 주변의 및을 예상한다는 것입니다. 당신이 당신의 's의 주위에 두는 경우에, 나는

+0

버그입니다. 나는이 문제를 해결하기 위해 다른 접근법을 사용하여 끝났지 만, 나는 미래를 염두에두고 이것을 지킬 것이다. – insertjokehere

관련 문제