包含元素的子元素后面不能创建XSLT属性节点(id) [英] XSLT attribute node (id) cannot be created after the children of the containing element

查看:87
本文介绍了包含元素的子元素后面不能创建XSLT属性节点(id)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常我通过Weblogic12服务器进行XSLT处理。我一直在讨论这个问题。

  net.sf.saxon.trans.DynamicError:属性节点
(id)不能在包含元素的子元素之后创建

在迁移之前,我们的团队完全没有问题...



任何想法为什么?我最近从BEA Weblogic3升级到Oracle Enterprise Weblogic 12.或者我错过了一个库?



这困扰着我们整个团队!谢谢!



编辑1:



错误指向< xsl:属性名称=id> < xsl:template name =makeErrorDiv>中

 < td> 
< 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 =descendant :: ErrMsg>
< xsl:call-template name =makeErrorDiv/>
< / xsl:if>
< / td>


< xsl:template name =makeErrorDiv>
< div style =display:none;>
< xsl:when test =descendant :: * [ParentId]>
< xsl:attribute name =id><![CDATA [$ err]]< xsl:value-of select =descendant :: ParentId [position()= 1] ]>< / XSL:属性>
< / xsl:when>
< xsl:when test =descendant :: * [ErrMsg] [Name]>
< xsl:attribute name =id>< xsl:value-of select =descendant :: * [ErrMsg] [position()= 1] / Name/><![ CDATA [$ ERR]] GT;< / XSL:属性>
< / xsl:when>
< xsl:when test =not(descendant :: * [ErrMsg])>
< xsl:variable name =name>< xsl:value-of select =descendant :: * [Name] [position()= 1] / Name/>< / xsl :可变>
< xsl:variable name =parsed>< xsl:value-of select =substring-before($ name,'!')/>< / xsl:variable>
< xsl:attribute name =id><! - 此处错误! - >
< xsl:when test =$ parsed =''>< xsl:value-of select =$ name/>< / xsl:when>
< xsl:otherwise>< xsl:value-of select =$ parsed/>< / xsl:otherwise>
< 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 :可变>
< xsl:variable name =parsed>< xsl:value-of select =substring-before($ name,'!')/>< / xsl:variable>
< xsl:attribute name =id>
< xsl:when test =$ parsed =''>< xsl:value-of select =$ name/>< / xsl:when>
< xsl:otherwise>< xsl:value-of select =$ parsed/>< / xsl:otherwise>
< xsl:text><![CDATA [$ err]]>< / xsl:text>< / xsl:attribute>
< / xsl:when>
< 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示例...不确定它是否有用...整个XML文件是1000行以上

 < DisclosureRowColor template =OneColumnposition =8lastPosition =30colCount =4color1 = #F2F8FEcolor2 =#ffffff> 
< Cell colspan =1>
< ListBox onchange =toggleAddressByAjax();>
<名称> APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!YLI< / Name>
<大小> 1< /大小>
<默认值rtexprvalue =true> mb.getValue(APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!YLI,A)< /默认值>
< Map rtexprvalue =true> mb.getGenericLookup(V_YEAR)< / Map>
< ReadOnly rtexprvalue =true> mb.isReadonly(2)< / ReadOnly>
< / ListBox>
< Label class =sTGBFBS>
< Caption> & amp; amp; amp; amp; nbsp; Jahre< / Caption>
< / Label>
< ListBox onchange =toggleAddressByAjax();>
<名称> APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!MLI< / Name>
<大小> 1< /大小>
<默认值rtexprvalue =true> mb.getValue(APPLICATION_CUSTOMER.EMPLOYED_SINCE_MM!MLI,A)< /默认值>
< Map rtexprvalue =true> mb.getGenericLookup(V_MONTH)< / Map>
< ReadOnly rtexprvalue =true> mb.isReadonly(2)< / ReadOnly>
< / ListBox>
< Label class =sTGBGBS>
< Caption> & amp; amp; amp; amp; nbsp; Monate< / Caption>
< / Label>
< ErrMsg />
< / Cell>
< / DisclosureRowColor>


解决方案

I think your problem可能是< xsl:attribute> 元素内的< xsl:text> 节点

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

我认为应该说

 < [CDATA [$ ERR]] GT;< / XSL:属性> 

因为您要创建一个属性,而不是文本节点。



更新:
我试图重现错误,但不能。但是,我确实发现撒克逊人在属性中使用了空格。您可能想尝试摆脱某些XSL元素之间的空白。

 < xsl:when test = 不(后代:: * [ERRMSG]) > 
< xsl:variable name =name>< xsl:value-of select =descendant :: * [Name] [position()= 1] / Name/>< / xsl :可变>
< 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属性之前,必须将一些文本添加到您的'div'元素。


Typically i am doing an XSLT process over a Weblogic12 server. I kept running into this issue

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

Before the migration, our team had no problems at all...

Any idea why? i recently upgraded from BEA Weblogic3 to Oracle Enterprise Weblogic 12. Or am i missing a library?

This is plaguing our entire team! Thanks!

EDIT 1:

Error points to <xsl:attribute name="id"> in <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 sample...not sure if it's helpful...the entire XML file is 1000+ lines

<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>

解决方案

I think your problem might be the <xsl:text> nodes inside of your <xsl:attribute> element

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

I think that should just say

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

since you're creating an attribute, not a text node.

Update: I tried to reproduce the error, but couldn't. BUT, I did find that saxon was using whitespace in the attribute. You might want to try Getting rid of some of the whitespace between some of the XSL elements.

<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>

And this might solve your the actual error you're seeing:

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

I think some text must be getting added to your 'div' element before the id attribute can be added.

这篇关于包含元素的子元素后面不能创建XSLT属性节点(id)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆