on 10-06-2004 12:12 AM
Hi guys,
I am writing an XSLT that maps fields from an idoc to a data type. In adddition to these fields there are further fields that the XSLT needs to populate in the data type. Some of these fields must contain e.g. 5 blank spaces - does anyone know how to create blank spaces within a tag that are retained by the XSLT processor? The reason for this is that the file adapter is causing new lines to occur for the same recordset when some fields contain no values. This causes problems when you have set fixed field lengths as a parameter for the recordset as each line is treated as a separate recordset.
Regards,
Dan.
Hi Dan,
you can add Spaces with the command xsl:text
<FiveSpaces>
<xsl:text> </xsl:text>
</FiveSpace>
I do not understand, your description of the behavior of the file adapter means. Is this a documented feature?
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
Thanks for that it works well - I discovered it earlier. The behaviour of the file adapter is not as documented and I have raised an OSS note - I needed to add spaces to elements as a work around as without values in elements the file adapter seems to separate a recordset onto multiple lines if you have more than one different recordset. I will post the outcome of this issue.
Regards,
Dan.
> Hi Stefan,
>
> Thanks for that it works well - I discovered it
> earlier. The behaviour of the file adapter is not as
> documented and I have raised an OSS note - I needed
> to add spaces to elements as a work around as without
> values in elements the file adapter seems to separate
> a recordset onto multiple lines if you have more than
> one different recordset. I will post the outcome of
> this issue.
>
> Regards,
>
> Dan.
The error I talked about is now corrected in note 781533.
I should add that this was an issue with an outbound file adapter using a centralized adapter and file content conversion. The problem was as follows:
We have a custom idoc with many segments e.g. ZCSCORD, ZCSCLD1, ZCSCLD2. There is an outbound interface in XI which is based upon the idoc
message type and the idoc structure is mapped to a message type in XI. The mapping works fine and the resulting XML document is to be converted
into a text file by the file adapter with a new line for each sub element. Taking a simple example of 2 sub elements the configuration in
the central file adapter is:
Recordset structure: CSCORD,CSCLD1
CSCORD.addHeaderLine 0
CSCORD.fieldFixedLengths 5,5,10,10,3
CSCLD1.addHeaderLine 0
CSCLD1.fieldFixedLengths 5,5,2,10,32
CSCLD1.fixedLengthTooShortHandling Cut
CSCORD.fixedLengthTooShortHandling Cut
The configuration works fine if there are values in all of the elements, and you get a file like this:
WE D 10000424 W E
ME G D 10000424 3
However, if there is no value in some of the elements the sub element is split over several lines:
WE
10000424W E
ME
100004243
I have implemented a work around by creating a second XSLT mapping that is performed in the interface mapping after the initial XSLT mapping and
adds a space to every element that is blank.
Hi Stefan,
I have to deliver an XML out from XI which has 3 namespaces
like <invoice xmlns="https..............."
xmlns:com="https..........."
xmlns:main="https............">.
This xml should be delivered to customer.
If the order of this namespace is changed, will it be a problem for customers to receive it. Is it mandatory that the namespace should be in exact order. I have a scenario where I am getting output xml from XI in an order which is different to the order mentioned above.
Thanks,
Deno
Hi Stefan,
I have one more query. In XSLT mapping, I need to convert date format yyyymmdd to yyyy-mm-dd. How would I do this? I know that this is a basic question but I am very new to XSLT mapping. And also can you please send me some good links in the net which has got reference for XSLT mapping specified on these formats and other stuffs like looping,
occurences, etc etc. Bcoz I need to play with lots of format changes for getting the relevant XML out from XI3.0.
I tried to search in google but did not get a good one.
Thanks,
Deno
Hi Deno,
1. The following links will aid you in writing an XSLT mapping to format date:
http://www.w3.org/TR/xslt20/#function-format-dateTime
http://www.w3.org/TR/xslt20/#date-time-examples
For your case try using the following example formatting:
format-date($d, "[Y0001]-[M01]-[D01]")
or
2.you can write a Java function for the date conversion and invoke this java function from XSLT mapping.
Check the following link for an example:
http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
For developing all your XSLT mappings try using a good editor like stylus studio.
Hope it helps !
Regards,
Sridhar
Hello,
You can use XSLT to do it by creating a "pseudo-function".
<!-- Dates -->
<xsl:template name="formatDate">
<xsl:param name="date"/>
<xsl:value-of select="substring($date,1,4)"/>-<xsl:value-of select="substring($date,5,2)"/>-<xsl:value-of select="substring($date,7,2)"/>
</xsl:template>
And use call-template to invoke this "pseudo-function" :
<xsl:call-template name="formatDate">
<xsl:with-param name="date" select="InvoiceIssueDate"/>
</xsl:call-template>
Regards,
Chris
Hi Christophe,
I have one more query.
I am using an XSLT mapping between invoic01idoc.xsd and invoice.xsd
In this, I am using a statement
<xsl:value-of select="INVOIC01/IDOC/E1EDKA1[PARVW='RS']/STRAS"/>
In the STRAS field of invoic01idoc, Both street and housenumber are together . I need
to get Street and house number separately in the output XML after mapping.
ie, it should be <street> Tampines</Street
and<housenumber>136</housenumber
now its coming as <street>Tampines136</Street
and blank for housenumber
Please provide some ideas for resolving this issue.
Thanks
Deno
Hi Christophe,
When i am doing XSLT mapping between idoc(invoic01).XSD and invoice.xsd,
Material number is coming out after mapping as 00000000000000001. But I need '1'. Same for
another material 000000000000000121 , needed is '121'.
Need to take out zeros from 000000000000000000001 and 0000000000000121. How to do this? Thanks in advance.
Deno
Hello,
In the XSLT put :
<street>
<xsl:value-of select="street"/>
<xsl:text> </xsl:text>
<xsl:value-of select="housenumber"/>
</street>
Sorry, It is not that you need. I thinks it's very difficult the only way it's if the housenumber is always a number and street is always without number.
In this case you can create a template that test if the string finish by a number and then cut it and put it in an other variable, ... I think it is very difficult to do it with XSLT but you can find help on this site :
http://www.zvon.org/xxl/XSLTreference/Output/index.html
Perhaps, It could be easier if you use an other mapping (graphical mapping) with java code.
Regards,
Chris
Message was edited by: Christophe DUMONT
Message was edited by: Christophe DUMONT
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.