Prevent the JDeveloper XSL mapper from breaking
Who has worked with the Design view of the XSL mapper in Oracle JDeveloper, knows that it works nice for simple mappings and drawing lines from one end to the other. However, when adding more complicated transformations, the moment arrives one has to modify the source. This usually results in mapper errors, and the Design view will not be displayed.
Although it’s not entirely avoidable this will happen at some point, there are a few guidelines for the notation of the XML code that help you use your Design Editor as long as possible.
Take a look at this xml snippet:
<rpy:postalcode>
<xsl:choose>
<xsl:when test="$country != 'USA'">
<xsl:value-of select="$Zip"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$foreignpostalcode"/>
</xsl:otherwise>
</xsl:choose>
</rpy:postalcode>
Althought the XML is perfectly valid, this will break the Design Editor. Why is that? Apparently, the editor doesn’t like the <postalcode> brackets outside of the <xsl:choose> construct. It seems to expect an entire element within the <xsl:when> and <xsl:otherwise> elements. When rewriting it with the <postalcode> brackets inside the construct, the editor still works in Design view:
<xsl:choose>
<xsl:when test=”$country != ‘USA'”>
<rpy:postalcode>
<xsl:value-of select=”$Zip”/>
</rpy:postalcode>
</xsl:when>
<xsl:otherwise>
<rpy:postalcode>
<xsl:value-of select=”$foreignpostalcode”/>
</rpy:postalcode>
</xsl:otherwise>
</xsl:choose>
I’m not sure if it’s desirable to rewrite all your transformations. It adds a lot of element tags, making it less readable. In case you use an <xsl:if> construct which might intendently result in an empty element, it’s even more work. In the end, you have a choice how much effort you want to put in having a visual representation of your transformation.
Overzicht blogs
Geen reacties
Geef jouw mening
Reactie plaatsenReactie toevoegen