on 08-08-2014 8:41 AM
Dear,
I'm busy creating XSLT mappings and all looks good, except for one. That one keeps failing and I just do not see why.
I tried different things, but the target structure remains empty.
Incoming message
After the mapping
XSLT mapping code
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1=<namespace>
xmlns:ns0=<namespace>
<xsl:template match="/">
<ns1:MessageType>
<UserId><xsl:value-of select="*/*/AuditUser"/></UserId>
<OrganisationId><xsl:value-of select="*/*/MessageType/OrganisationId"/></OrganisationId>
<OUIdArray>
<xsl:for-each select="*/*/MessageType/OUIdArray/OUId">
<OUId><xsl:value-of select="*/*/OUIdArray/OUId"/></OUId>
</xsl:for-each>
</OUIdArray>
<DateFrom><xsl:value-of select="*/*/MessageType/DateFrom"/></DateFrom>
<DateUntil><xsl:value-of select="*/*/MessageType/DateUntill"/></DateUntil>
</ns1:MessageType>
</xsl:template>
</xsl:stylesheet>
Anyone a suggestion?
Thanks a lot.
Dimitri
Hi Dimitri,
In your XSL i noticed that you have
<OUId><xsl:value-of select="*/*/OUIdArray/OUId"/></OUId>
instead of
<OUId><xsl:value-of select="*/*/MessageType/OUIdArray/OUId"/></OUId>
However, i would do in this way:
With this source XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<OrganisationID> 1000</OrganisationID>
<OUIdArray>
<OUId>1 </OUId>
<OUId>2 </OUId>
<OUId>3 </OUId>
</OUIdArray>
<DateFrom>01.01.2010</DateFrom>
</root>
I would use this code XSL:
<OUIdArray>
<xsl:for-each select="/root/OUIdArray/OUId">
<OUId>
<xsl:value-of select="."/>
</OUId>
</xsl:for-each>
</OUIdArray>
It's simplier under my point of view.
Hope this helps.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for the quick and correct answer!
Just one thing...
I see that a specific field in the target structure is marked as mandatory (occurrence = 1).
If I do not provide that field in the incoming messages, the XSLT mapping is performed without any error, but I expected to see and error somewhere, no?
Is there a possibility to check on mandatory fields or something else I could do to make sure a mandatory target field is filled or an error is raised?
Thanks.
Dimitri
Hi Dimitri,
With only XSL and without call any java class, i dont know any smart way to do it, may be with xsl:if (XSLT &lt;xsl:if&gt; Element) and harcoding the mandatory fields. Perhaps, anybody knows a better way.
Regards.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.