Map View is one of two graphical views provided by the new
12c XSLT Editor.
a quick introduction to the graphical views in the 12c XSLT Editor see: 12c XSLT Editor Overview
Map View provides a typical mapping tool to create pull-style
XSLT. If you have used the 11g XSLT
Mapper, Map View will be very familiar to you. .
After selecting source and target schema elements for the
input and output XML documents to the XSLT, the editor, by default, opens in
Map View (this behavior can be changed in preferences). This view shows the source schema document on
the left and the target schema document on the right.
The user can then create mappings by dragging lines from a
source element to a target element.
For instance, two simple mappings are shown below:
Once an element or attribute is mapped in the target tree,
that target element is created in the XSLT source. The user can view and edit the XSLT source
directly by clicking the Source tab at the bottom of the editor panel.
For the mappings
shown above, the XSLT source appears as:
font-family: 'Courier New';"> <tns:Invoice>
Note that mapped elements in the target tree are displayed
with black text and unmapped elements in the target tree are displayed with
grayed, italicized text. The unmapped
elements are part of the defined target schema document. The mapped elements are defined both in the
target schema document and the XSLT source. To see this, compare the XSLT source to the picture above showing
the simple mappings.
Each mapping line in the display above represents a simple
XPath expression that references a node in the input/source XML document. Complex XPath expressions can be created from
XPath functions and operators in many different ways. Complex XPath expressions appear as icons on
the center canvas panel.
screenshot below shows several complex XPath expressions that have been added
to the mapping.
Each expression can be seen through tooltips as shown above. The user can also view and edit the
expression either as a full text expression or as a parsed expression where
each function parameter can be edited separately.
For instance, with the concat function selected above, if we
double click on the concat icon that we have moused-over, the parsed form
appears in a dialog.
If we double-click on the folder containing the icon (purple
area surrounding the icon), we get the full text form for the XPath expression:
Extra long XPath expressions can be edited by clicking the
Edit Long Text button.
When the Properties Window is displayed, the user can edit
in the properties window in a similar manner by either selecting a specific
function icon or the external folder containing the icon. The user may also graphically edit the XPath
expressions by dragging and dropping functions from the Components Window to an
XPath expression folder.
The output of an expression can be assigned to a specific
target node by dragging and dropping a line from the expression to a target
node. Similarly, simple XPath
expressions representing source nodes can be created by dragging and dropping lines
to the icons and dropping them on specific function parameters.
Here we drop an input to the 3rd parameter of a concat function.
The user may also create XSLT instructions such as: xsl:for-each, xsl:if,
xsl:choose/when/otherwise, xsl:param, xsl:variable, etc. Only one xsl:template instruction is allowed
in Map View, that is the root template instruction with match=”/” attribute as shown
in the pictures above. XSLT maps with
multiple templates can be edited in XSLT View.
map below shows the insertion of some of these XSLT statements. They are used to loop over the Items in a
purchase order and apply a discount to any items that are delayed (have no
In the next post I will discuss the use of XSLT View.