2012-09-05 41 views
0

通常,我正在通過Weblogic12服務器執行XSLT過程。我一直運行到這個問題在包含元素的子元素之後無法創建XSLT屬性節點(id)

net.sf.saxon.trans.DynamicError: An attribute node 
(id) cannot be created after the children of the containing element 

遷移之前,我們的團隊已經完全沒有問題......

任何想法,爲什麼?我最近從BEA Weblogic3升級到Oracle Enterprise Weblogic 12.或者我錯過了一個庫?

這是困擾我們整個團隊!謝謝!

編輯1:<xsl:template name="makeErrorDiv">

<td> 
      <xsl:copy-of select="@colspan | @align | @style | @valign | @class | @id | @name"/> 
      <xsl:if test="@colspan = '1' and $columnWidth != '' and not(@suppressColWidth='true')"><xsl:attribute name="width"><xsl:value-of select="$columnWidth"/></xsl:attribute></xsl:if> 
      <xsl:if test="@rowspan != '1'"><xsl:copy-of select="@rowspan"/></xsl:if> 

      <xsl:if test="descendant::ErrMsg"> 
       <xsl:call-template name="makeErrorDiv"/> 
      </xsl:if> 
     </td> 


<xsl:template name="makeErrorDiv">  
     <div style="display:none;"> 
      <xsl:choose> 
       <xsl:when test="descendant::*[ParentId]"> 
        <xsl:attribute name="id"><xsl:value-of select="descendant::ParentId[position() = 1]"/><![CDATA[$err]]></xsl:attribute> 
       </xsl:when>   
       <xsl:when test="descendant::*[ErrMsg][Name]"> 
        <xsl:attribute name="id"><xsl:value-of select="descendant::*[ErrMsg][position() = 1]/Name"/><![CDATA[$err]]></xsl:attribute> 
       </xsl:when> 
       <xsl:when test="not(descendant::*[ErrMsg])"> 
        <xsl:variable name="name"><xsl:value-of select="descendant::*[Name][position() = 1]/Name"/></xsl:variable> 
        <xsl:variable name="parsed"><xsl:value-of select="substring-before($name, '!')"/></xsl:variable> 
        <xsl:attribute name="id"><!--error here! --> 
         <xsl:choose> 
          <xsl:when test="$parsed = ''"><xsl:value-of select="$name"/></xsl:when> 
          <xsl:otherwise><xsl:value-of select="$parsed"/></xsl:otherwise> 
         </xsl:choose> 
        <xsl:text><![CDATA[$err]]></xsl:text></xsl:attribute> 
       </xsl:when> 
       <xsl:when test="descendant::*[ErrMsg][not(Name)]"> 
        <xsl:variable name="name"><xsl:value-of select="descendant::*[Name][position() = 1]/Name"/></xsl:variable> 
        <xsl:variable name="parsed"><xsl:value-of select="substring-before($name, '!')"/></xsl:variable> 
        <xsl:attribute name="id"> 
         <xsl:choose> 
          <xsl:when test="$parsed = ''"><xsl:value-of select="$name"/></xsl:when> 
          <xsl:otherwise><xsl:value-of select="$parsed"/></xsl:otherwise> 
         </xsl:choose> 
        <xsl:text><![CDATA[$err]]></xsl:text></xsl:attribute>     
       </xsl:when> 
      </xsl:choose> 
      <span style="color: #FF0000; font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; text-decoration: none;"><xsl:value-of select="descendant::ErrMsg[position() = 1]"/></span> 
     </div>  
    </xsl:template> 

XML樣本中

錯誤點<xsl:attribute name="id"> ...不知道,如果它是有幫助的......整個XML文件是1000+線

<DisclosureRowColor template="OneColumn" position="8" lastPosition="30" colCount="4" color1="#F2F8FE" color2="#ffffff"> 
       <Cell colspan="1"> 
        <ListBox onchange="toggleAddressByAjax();"> 
         <Name>APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!YLI</Name> 
         <Size>1</Size> 
         <Default rtexprvalue="true">mb.getValue("APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!YLI", "A")</Default> 
         <Map rtexprvalue="true">mb.getGenericLookup("V_YEAR")</Map> 
         <ReadOnly rtexprvalue="true">mb.isReadonly(2)</ReadOnly> 
        </ListBox> 
        <Label class="sTGBFBS"> 
         <Caption> &amp;nbsp;&amp;nbsp;Jahre </Caption> 
        </Label> 
        <ListBox onchange="toggleAddressByAjax();"> 
         <Name>APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!MLI</Name> 
         <Size>1</Size> 
         <Default rtexprvalue="true">mb.getValue("APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!MLI", "A")</Default> 
         <Map rtexprvalue="true">mb.getGenericLookup("V_MONTH")</Map> 
         <ReadOnly rtexprvalue="true">mb.isReadonly(2)</ReadOnly> 
        </ListBox> 
        <Label class="sTGBGBS"> 
         <Caption> &amp;nbsp;&amp;nbsp;Monate </Caption> 
        </Label> 
        <ErrMsg/> 
       </Cell> 
      </DisclosureRowColor> 
+3

這是XSLT的問題。 (最有可能放置'xsl:attribute'。)你可以發佈XSLT嗎? –

+1

同上DevNull說。您可能正在嘗試在發出文本或元素後使用'xsl:attribute'發出節點。您可能以前使用過不同的XSLT處理器,但沒有抱怨過這種情況。發佈您的XSLT,我們將幫助發現問題。它應該是可以修復的。 – LarsH

+0

嗨,大家好,我剛剛添加了源代碼... – bouncingHippo

回答

2

認爲您的問題可能是<xsl:text>節點內的<xsl:attribute> ele換貨

<xsl:text><![CDATA[$err]]></xsl:text></xsl:attribute> 

我認爲應該只說

<![CDATA[$err]]></xsl:attribute> 

因爲你創建一個屬性,而不是文本節點。

更新: 我試圖重現錯誤,但不能。但是,我確實發現撒克遜人在屬性中使用了空格。您可能想嘗試擺脫一些XSL元素之間的一些空白。

<xsl:when test="not(descendant::*[ErrMsg])"> 
       <xsl:variable name="name"><xsl:value-of select="descendant::*[Name][position() = 1]/Name"/></xsl:variable> 
       <xsl:variable name="parsed"><xsl:value-of select="substring-before($name, '!')"/></xsl:variable> 
       <xsl:attribute name="id"><xsl:choose> 
         <xsl:when test="$parsed = ''"><xsl:value-of select="$name"/></xsl:when> 
         <xsl:otherwise><xsl:value-of select="$parsed"/></xsl:otherwise> 
        </xsl:choose><xsl:text><![CDATA[$err]]></xsl:text></xsl:attribute> 
      </xsl:when> 

這可能會解決你的實際的錯誤,你看到:

<div style="display:none;"><xsl:choose> 

我覺得一些文字一定是添加到您的「格」元素可以添加id屬性之前。

+0

這是一個敏銳的觀察!我現在正在測試您的解決方案.. – bouncingHippo

+0

嘗試了您的解決方案,仍遇到相同的錯誤.. – bouncingHippo

+0

您是否從兩個地方刪除它?有兩次發生。此外,您可能想嘗試刪除每個'when'元素以精確縮小問題的位置。 – JohnnyK

相關問題