June 1, 2009

Invalid Usage of Element

Just ran into something annoying the past 10 minutes when working on a BPEL process (related to XSLT).

My transformation included the following (which I had manually entered in JDeveloper):
    <ns0:QualificationDate>
    <xsl:if test="number(ns1:Highest/ns1:QualificationDate) > 0">
    <xsl:value-of select="number(ns1:Highest/ns1:QualificationDate) + 190000"/>
    </xsl:if>
    </ns0:QualificationDate>
However, when I clicked on the "Design" tab of the mapper tool to switch from Source to Design mode, I received the following error:
    Transformation_2.xsl
    Error: Invalid Usage of <if> Element
Turns out, the correct usage of the <if> element is the following:
    <xsl:if test="number(ns1:Highest/ns1:QualificationDate) > 0">
    <ns0:QualificationDate>
    <xsl:value-of select="number(ns1:Highest/ns1:QualificationDate) + 190000"/>
    </ns0:QualificationDate>
    </xsl:if>

It's the little things that get you sometimes.

4 comments: