Hello,
I've extracted this from my XSLT :
Code:
<xsl:element name="resource"><xsl:text>
</xsl:text>
<xsl:variable name="OnTime" select="Resource:checkOnTime($resource, xs:string('PX8'), xs:integer(8))" as="xs:boolean"/>
<xsl:variable name="OffTime" select="Resource:checkOffTime($resource, xs:string('PX8'), xs:integer(7))" as="xs:boolean"/>
<xsl:if test="$OffTime or $OnTime">
<xsl:element name="errors"><xsl:text>
</xsl:text>
<xsl:variable name="errors" select="Resource:getErrors($resource)"/>
<xsl:variable name="count" select="Errors:getCount($errors)"/>
<xsl:for-each select="0 to ($count -1)">
<xsl:variable name="error" select="Errors:getError($errors, .)"/>
<xsl:element name="error"><xsl:text>
</xsl:text>
<xsl:attribute name="id" select="Error:getID($error)"/>
<xsl:attribute name="severity" select="Error:getSeverity($error)"/>
<xsl:value-of select="Error:getDescription($error)"/>
</xsl:element><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:element><xsl:text>
</xsl:text>
</xsl:if>
</xsl:element>
Where $resource is a POJO class instance passed to the XSLT as a parameter. But when I run this transformation I get this error.
Code:
Error at xsl:if on line 235
XTDE0410: Cannot create an attribute node after creating a child of the containing element net.sf.saxon.s9api.SaxonApiException
*** the remainder removed for brevity ***
I am at a loss as to why such an error would be generated as I am clearly not creating an attribute but an element (as allowed by the Schema), and the creation of this element is of course subject to the outcome of the offending <xsl:if />
Can anyone shed some light on this for me please?
--
William