How to Map an Optional Source Node to an Optional Target Node How to Load System IDs Dynamically

23-4 Developers Guide for Oracle Application Integration Architecture Foundation Pack Example 23–1 illustrates the domain value map lookup call to fetch Currency Code. The domain value maps should be used only for static lookup calls such as Currency Codes, Location Codes, and so on. Example 23–1 Domain Value Map Lookup Call to Fetch Currency Code corecom:PreferredFunctionalCurrencyCode xsl:value-of select=dvm:lookupValueoramds:appsAIAMetaDatadvmCURRENCY_ CODE.dvm,SenderSystemId,xsdLocal:ListOfCmuAccsyncAccountIoxsdLocal:Account xsdLocal:CurrencyCode,TargetSystemId, corecom:PreferredFunctionalCurrencyCode

23.2.2 Handling Missing or Empty Elements

Transformation logic and xpath should be designed with the possibility of missing or empty elements, as shown in Example 23–2 . Example 23–2 Sample Code Illustrating Logic Designed to Handle Missing or Empty Elements xsl:iftest=normalize- space=xsdLocal:ListOfCmuAccsyncAccountIoxsdLocal:AccountxsdLocal:AccountId text corecom:ApplicationObjectKey corecom:ID xsl:value-of select=xsdLocal:ListOfCmuAccsyncAccountIoxsdLocal:AccountxsdLocal: AccountId corecom:ID corecom:ApplicationObjectKey xsl:if In this example, an if condition exists to check the empty elements. You should adopt such transformation logic to avoid transporting empty elements across the wire.

23.2.3 How to Map an Optional Source Node to an Optional Target Node

When mapping an optional source node to an optional target node, you should surround the mapping with an xsl:if statement that tests for the existence of the source node. If you do not do this, as shown in Example 23–3 , and the source node does not exist in the input document, then an empty node is created in the target document. Example 23–3 Statement Without xsl:If portal:PHONE xsl:value-of select=corecom:Contactcorecom:ContactPhoneCommunication[1]corecom: PhoneCommunicationcorecom: WorkContactNumber portal:PHONE If the PHONE field is optional in both the source and target and the WorkContactNumber does not exist in the source document, then an empty PHONE element is created in the target document. To avoid this situation, add an if statement to test for the existence of the source node before the target node is created, as shown in Example 23–4 . Working with Message Transformations 23-5 Example 23–4 Statement With xsl:If xsl:if test=corecom:Contactcorecom:ContactPhoneCommunication[1]corecom: PhoneCommunicationcorecom:WorkContactNumber portal:PHONE xsl:value-of select=corecom:Contactcorecom:ContactPhoneCommunication[1]corecom: PhoneCommunicationcorecom:WorkContactNumber portal:PHONE xsl:if

23.2.4 How to Load System IDs Dynamically

ABCS and XSL scripts should not be hard-coded to work against one specific logical application instance, as shown in Example 23–5 . No hard-coded system IDs should exist in XSL Scripts and ABCS. Example 23–5 Sample Code Showing Hard-Coded System IDs - Not Recommended corecom:PreferredFunctionalCurrencyCode xsl:value-of select=dvm:lookupValueoramds:appsAIAMetaDatadvmCURRENCY_CODES. dvm,SEBL_01, xsdLocal:ListOfCmuAccsyncAccountIoxsdLocal:AccountxsdLocal:CurrencyCode, COMMON , corecom:PreferredFunctionalCurrencyCode The recommended approach is to load the system IDs dynamically, as shown in Example 23–6 . Example 23–6 Sample Code Showing Use of Variables Instead of Hard-coded System IDs - Recommended corecom:PreferredFunctionalCurrencyCode xsl:value-of select=dvm:lookupValueoramds:appsAIAMetaDatadvmCURRENCY_ CODES.dvm,SenderSystemId,xsdLocal:ListOfCmuAccsyncAccountIoxsdLocal: AccountxsdLocal:CurrencyCode,TargetSystemId corecom:PreferredFunctionalCurrencyCode

23.2.5 Using XSLT Transformations on Large Payloads