XSLT - if condition

hi
i wanted to check a value with condition.
something like this
<xsl:variable name="rootname" select="name()">
i wanted to check whether the $rootname= SportsData.
how will i express this condition in a conditional statement
rgds

<xsl:choose>
          <xsl:when test="$blah='blah'">
          </xsl:when>
</xsl:choose>

Similar Messages

  • XSLT-like conditional indexes

    Is there a plan to introduce conditional indexes the way it's done in XSLT?
    Something like this:
    <xsl:key name="action" match="/*/ENTRY[(@Operation='notify' or @operation='notify')]/DATA" use="@action"/>

    From the top of my head:
    1. Index by attribute value when another attribute of the same element has particular value[s], or evaluation of another attribute has particular value[s]. Combining of two indexes is not the same at all.
    2. Index by element or attribute when path is important and there are other elements/attributes with the same name or exactly the same element, but located differently in tree.
    I didn't look into documentation too deep, but it seems I never saw Berkeley DB XML supports full text search index. Does it?

  • Xslt multi conditions checking.

         Hi,
    Please could you help me how I can achieve my requireemnt through xslt.
    in an xml, I will pass the belwo records
    <Main>
    <HOME RecNo="1">
                  <Articles useFilter="True"    CID="LGTS22"   BVal="MUG"/>
                <Articles useFilter="False"     CID="LGTS22"    BVal="MUG"/>
    </HOME>
    <HOME RecNo="2">
                  <Articles useFilter="False"  CID="LGTS22"    BVal="BBB"/>
                <Articles useFilter="True"    CID="XXX"    BVal="MUG"  BID="LGTS22"  />
    </HOME>
    <HOME RecNo="3">
                  <Articles useFilter="False"  CID="ABCS22"    BVal="MUG"/>
                <Articles useFilter="True"    CID="XXX"    BVal="MUG"  BID="ABCS22"  />
    </HOME>
    </Main>
    My requirement is like this.
    I will be passign the Home record to the xslt. in the xslt I need to check like this, based on Bval and useFilter I need to check the CID/BID values, as mentioned below.
    1. in the articles element if Bval is MUG, then check the value of UseFilter, if the useFilter is False then check the value of CID which is having  'LGT' value in it. then return the value as it is LGT. (first record)
    2. in the articles element if Bval is MUG, then check the value of UseFilter, if the useFilter is True then check the value of BID, not the CID attribute value which is having  'LGT' value in it. then return the value as it is LGT. (second record)
    3. If both above condtions are not met then return as nonLGT.(third record)
    Thanks.

    It's not clear whether you pass the entire document in one go or individual HOME records, and whether you want an XML output or a single text value for each record, and what this "value" should be.
    Can you clarify by giving the expected output?

  • Help required on XSLT Conditional Mapping

    Hi,
    We need help on XSLT mapping in BPEL based on a condition. We are transforming from OAG format to a client specific format. We need to map a single tag (but repetitive) on the left hand side (OAG) to different tags on the right hand side. The same tag on the left hand side repeats with different values. Depending on the value the mapping to the right hand side varies. The left hand side (OAG) looks something like this.
    <PARTNER>
    <PARTNRID>2002</PARTNRID>
    <PARTNRTYPE>Supplier</PARTNRTYPE>
    <ADDRESS>
    <ADDRLINE index="1">2000 Century Way</ADDRLINE>
    </ADDRESS>
    </PARTNER>
    <PARTNER>
    <PARTNRID>204</PARTNRID>
    <PARTNRTYPE>BillTo</PARTNRTYPE>
    <ADDRESS>
    <ADDRLINE index="1">90 Fifth Avenue</ADDRLINE>
    </ADDRESS>
    </PARTNER>
    Please note that the tag PARTNER and it's underlying tags appear twice in the XML file.
    Based on the value in the tag PARTNRTYPE, the mapping to the right hand side differs. If the value is 2002, PARTNRID should map to Supplier ID on the right hand side and if the value is 24, PARTNRID should map to BillTo ID on the right hand side. The right hand side should look something like
    <Supplier>
    <SupplierID>2002</SupplierID>
    <Address>2000 Century Way</Address>
    </Supplier>
    <BillTo>
    <BillToID>204</BillToID>
    <Address>90 Fifth Avenue</Address>
    </BillTo>
    Please let us know how to achieve this. Your help is much appreciated. Thanks in advance.
    Thanks,
    Prasanna

    Hi Prasanna ,
    I am not an expert but what about this:
    <SUPPLIERID>
      <xsl:value-of select="/PARTNER/PARTNRID[../PARTNRTYPE = '2002']"/>
    </SUPPLIERID>
    <BILLTOID>
      <xsl:value-of select="/PARTNER/PARTNRID[../PARTNRTYPE = '24']"/>
    </BILLTOID>or
    <xsl:choose>
      <xsl:when test="/PARTNER/PARTNRTYPE = '2002'">
        <SUPPLIERID>
          <xsl:value-of select="/PARTNER/PARTNRID"/>
        </SUPPLIERID>
      </xsl:when>
    </xsl:choose>
    <xsl:choose>
      <xsl:when test="/PARTNER/PARTNRTYPE = '24'">
        <BILLTOID>
          <xsl:value-of select="/PARTNER/PARTNRID"/>
        </BILLTOID>
      </xsl:when>
    </xsl:choose>Regards Pete

  • XSLT code - If Condition

    Hello,
    Can someone help me to give an XSLT code for the following condition?
    Source Message:
    /Order/Ident/ReceiverID = 203
    Condition:
    If the value of Source ReceiverID is 203, then, make it to the value to 456.
    I've tried this code, but seems to be many error validations.
    <xsl:template match="/Order/Ident/ReceiverID">
          <xsl:choose>
            <xsl:when test="203">
              <xsl:attribute name="203">
                   <xsl:value-of select="456"/>
                </xsl:attribute>
             </xsl:when>
            <xsl:otherwise>
              <xsl:attribute name="203">unknown</xsl:attribute>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
    Should you have helpful links, please let me know. I will greatly appreciate it.
    Thanks in advance!
    Gerberto

    Gerberto,
    Try this -
    <xsl:choose>
         <xsl:when test="*[local-name()='ReceiverID']='203' ">
              <ns:YourField>
                   <xsl:value-of select="456"/>
              </ns:YourField>
         </xsl:when>
         <xsl:otherwise>
              <ns:YourField>
                   <xsl:value-of select="203"/>
              </ns:YourField>
         </xsl:otherwise>
    </xsl:choose>
    Let me know if this works for you.
    Regards,
    Neetesh

  • Conditional increment in XSLT

    In a Shipment the number of orders is present. For each order there is a number of order line Items. Order Line Items contain item. For each iteration we are maintaining the hierarchy levels. In the orderLine Items section, if the previous item is equal to current item, there is no need to increment hierarchy.
    points:
    There is only one shipment
    Number of orders are present per shipment.
    number of orderLineItems per each order.
    for each iteration of orders and orderlineItems we have to maintain a hierarchy levels(increment value),*but when comes to orderLineItems one condition is there if the previous item is equals to Current item,no need to increment hierarchy level.otherwise we should increment the hierarchy levels* like below output we needed.
    below is the input.
    Input:
    <Shipment>
    <Shipment1>Shipment151</Shipment1>
    <ShipmentValue>ShipmentValue52</ShipmentValue>
    <Order>
    <Orderlevel1>Orderlevel153</Orderlevel1>
    <Orderlevel2>Orderlevel254</Orderlevel2>
    <Orderlevel3>Orderlevel355</Orderlevel3>
    <OrderLineItems>
    <Level1>Level156</Level1>
    <Level2>Level257</Level2>
    <Level3>Level358</Level3>
    <Item>Item59</Item>
    </OrderLineItems>
    <OrderLineItems>
    <Level1>Level160</Level1>
    <Level2>Level261</Level2>
    <Level3>Level362</Level3>
    <Item>Item59</Item>
    </OrderLineItems>
    <OrderLineItems>
    <Level1>Level164</Level1>
    <Level2>Level265</Level2>
    <Level3>Level366</Level3>
    <Item>Item63</Item>
    </OrderLineItems>
    </Order>
    <Order>
    <Orderlevel1>Orderlevel168</Orderlevel1>
    <Orderlevel2>Orderlevel269</Orderlevel2>
    <Orderlevel3>Orderlevel370</Orderlevel3>
    <OrderLineItems>
    <Level1>Level171</Level1>
    <Level2>Level272</Level2>
    <Level3>Level373</Level3>
    <Item>Item74</Item>
    </OrderLineItems>
    <OrderLineItems>
    <Level1>Level175</Level1>
    <Level2>Level276</Level2>
    <Level3>Level377</Level3>
    <Item>Item78</Item>
    </OrderLineItems>
    <OrderLineItems>
    <Level1>Level179</Level1>
    <Level2>Level280</Level2>
    <Level3>Level381</Level3>
    <Item>Item78</Item>
    </OrderLineItems>
    </Order>
    </Shipment>
    below is the output we need.
    Output:
    <ns1:Shipment>
    <ns1:Shipment1>1</ns1:Shipment1>
    <ns1:ShipmentValue>S</ns1:ShipmentValue>
    <ns1:Order>
    <ns1:Orderlevel1>2</ns1:Orderlevel1>
    <ns1:Orderlevel2>1</ns1:Orderlevel2>
    <ns1:Orderlevel3>O</ns1:Orderlevel3>
    <ns1:OrderLineItems>
    <ns1:Level1>3</ns1:Level1>
    <ns1:Level2>2</ns1:Level2>
    <ns1:Level3>I</ns1:Level3>
    <ns1:Item>Item59</ns1:Item>
    </ns1:OrderLineItems>
    <ns1:OrderLineItems>
    <ns1:Item>Item59</ns1:Item>
    </ns1:OrderLineItems>
    <ns1:OrderLineItems>
    <ns1:Level1>4</ns1:Level1>
    <ns1:Level2>2</ns1:Level2>
    <ns1:Level3>I</ns1:Level3>
    <ns1:Item>Item63</ns1:Item>
    </ns1:OrderLineItems>
    </ns1:Order>
    <ns1:Order>
    <ns1:Orderlevel1>5</ns1:Orderlevel1>
    <ns1:Orderlevel2>1</ns1:Orderlevel2>
    <ns1:Orderlevel3>O</ns1:Orderlevel3>
    <ns1:OrderLineItems>
    <ns1:Level1>6</ns1:Level1>
    <ns1:Level2>5</ns1:Level2>
    <ns1:Level3>I</ns1:Level3>
    <Item>Item74</Item>
    </ns1:OrderLineItems>
    <ns1:OrderLineItems>
    <ns1:Level1>7</ns1:Level1>
    <ns1:Level2>5</ns1:Level2>
    <ns1:Level3>I</ns1:Level3>
    <Item>Item78</Item>
    </ns1:OrderLineItems>
    <ns1:OrderLineItems>
    <ns1:Item>Item78</ns1:Item>
    </ns1:OrderLineItems>
    </ns1:Order>
    </ns1:Shipment>
    Edited by: 913885 on Mar 17, 2013 9:06 AM

    yes, there is a global variable concept in XI which u can use for your Sequence Number concept.
    If you are on SP14 and above, just take a lookat this blog and the GLOBAL Variables Section
    XI: New features in SP14
    check this thread
    Re: Need Help in XSLT Mapping
    Re: Sequence Number in XI Mapping

  • Complex conditional mappings - XSLT constructs

    Hi,
    Please confirm if following such complex conditional mappings are possible using
    BPEL Jdev and how can these be achieved
    I could not find anything in XSLT constructs of BPEL or either tutorials which
    would help me in ascertaining if the following types are possible in BPEL.
    the items that fall before "_" below are the elements
    suffixes source and target indicates that elements are of target or source
    xsd
    constants are indicated by _constant
    if (x_source=c1_constant or x_source=c2_constant)
    then
    b_target=(b_source "concatenated with" d_source)
    else b_target=b_source
    if (a_source>a1_constant)
    and
    if (x_source!=c1_constant or x_source!=c2_constant)
    then
    a_target=a_source
    We are planning to Use BPEL/B2B for EDI. Our current EDI systems have such kind
    of complex mappings requirements where those are resolved by EDI tool, wanted
    to check if same is possible in BPEL and how can this be achieved
    Thanks
    Sachin Sutar

    Of course, use an XSL to transform from source XSD to destination XSD.
    Check out http://www.w3.org/TR/xslt to see conditional processing in XSLT. You may either use xsl:if and xsl:choose for conditional processing in XSL.

  • XSLT check multiple conditions

    hello
    I don't know whether this would be appropriate in this forum but one of my interface has XSLT mappings and we have to add certain conditions for some tags to get generated.
    I checked XSLT APIs and found out <xsl:if> tag and my one condition works fine.
    e.g. <xsl:if test="$flg_type='xyz' >
    <tags to be generated>
    </xsl:if>
    But now the requirement is like those tags should get generated when flg_type = 'xyz' or flg_type = 'abc' and 5 such conditions.
    Does anyone know how to add "OR" or "AND" condition inside <xsl:if>
    Thanks in advance.
    Regards
    Rajeev

    Looks good
    Ref: http://msdn2.microsoft.com/en-gb/library/ms256081.aspx (only small letters form the syntax)

  • Anyway to create a conditional output instruction in XSLT?

    The doctype-system value in an output instruction in my XSLT has to vary depending on a value of a variable. However, choose and if cannot be used outside a template instruction. Is there any other way to put a conditional on an output instruction? Below is the code I tried, but is not valid. I'm hard coding the value of the variable named "short" to "1". It could also be set to zero.
         <xsl:variable name="short" select="1"/>
         <xsl:choose>
              <xsl:when test="$short">
                   <xsl:output method="xml" version="1.0" indent="yes"
                        doctype-system="http://www.editeur.org/onix/2.0/short/onix-international.dtd"
                        encoding="ISO-8859-1"/>
              </xsl:when>
              <xsl:otherwise>
                   <xsl:output method="xml" version="1.0" indent="yes"
                        doctype-system="http://www.editeur.org/onix/2.0/reference/onix-international.dtd"
                        encoding="ISO-8859-1"/>
              </xsl:otherwise>
         </xsl:choose>

    Refer:
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/attaching-smartform-to-the-standard-transaction-2316027

  • Multi Mapping using condition & Dynamic Receiver determination – Used XSLT Mapping

    Dear Experts,
         I am struggling to identify an error on the Technical Routing. Firstly according to my scenario, I receive an XML file with multiple PO's and I have to split the file to 2 different target messages. and also according to the source payload I have to send the file to 2 different receivers. first receiver is ABAP Proxy to the back end system and the 2nd one is to a file location. I have used XSLT to split the message into 2 target message type and I have used a XSLT mapping for receiver determination. Does any one have any idea of what I am doing wrong.
    Note: some time I will only be able to fill in on target message.
    I have attached my XSLT message split mapping with this post, please let me know if you have further question.
    Your help is more appreciated.
    Advance Thanks,
    Pradeep
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:variable name="vFlag"/>
      <xsl:variable name="vPONUM" select="POTRACKING/Lines[1]/PONumber"/>
      <xsl:template match="/">
        <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
          <ns0:Message1>
            <ns1:MT_Tracking xmlns:ns1="http://www.findel-education.co.uk/axapta">
              <xsl:for-each select="POTRACKING/Lines">
                <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">
                  <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>
                  <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>
                </sap:call-external>
                <xsl:if test="$vFlag = 0">
                  <Lines>
                    <DDate>
                      <xsl:value-of select="DespatchDate"/>
                    </DDate>
                    <PONumber>
                      <xsl:value-of select="PONumber"/>
                    </PONumber>
                    <POLine>
                      <xsl:value-of select="POLine"/>
                    </POLine>
                    <QTY>
                      <xsl:value-of select="Quantity"/>
                    </QTY>
                    <VendorMaterial>
                      <xsl:value-of select="VendorMaterialNumber"/>
                    </VendorMaterial>
                    <AccountRef>
                      <xsl:value-of select="AccountReference"/>
                    </AccountRef>
                    <ConsignNumber>
                      <xsl:value-of select="ConsignmentNumber"/>
                    </ConsignNumber>
                    <CarrierURL>
                      <xsl:value-of select="CarrierURL"/>
                    </CarrierURL>
                    <ConsignURL>
                      <xsl:value-of select="ConsignmentURL"/>
                    </ConsignURL>
                  </Lines>
                </xsl:if>
              </xsl:for-each>
            </ns1:MT_Tracking>
          </ns0:Message1>
          <ns0:Message2>
            <ns2:MT_Tracking xmlns:ns2="http://www.findel-education.co.uk/ecc/ax/po/ftp">
              <xsl:for-each select="POTRACKING/Lines">
                <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">
                  <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>
                  <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>
                </sap:call-external>
                <xsl:if test="$vFlag = 1">
                  <Lines>
                    <DDate>
                      <xsl:value-of select="DespatchDate"/>
                    </DDate>
                    <PONumber>
                      <xsl:value-of select="PONumber"/>
                    </PONumber>
                    <POLine>
                      <xsl:value-of select="POLine"/>
                    </POLine>
                    <QTY>
                      <xsl:value-of select="Quantity"/>
                    </QTY>
                    <VendorMaterial>
                      <xsl:value-of select="VendorMaterialNumber"/>
                    </VendorMaterial>
                    <AccountRef>
                      <xsl:value-of select="AccountReference"/>
                    </AccountRef>
                    <ConsignNumber>
                      <xsl:value-of select="ConsignmentNumber"/>
                    </ConsignNumber>
                    <CarrierURL>
                      <xsl:value-of select="CarrierURL"/>
                    </CarrierURL>
                    <ConsignURL>
                      <xsl:value-of select="ConsignmentURL"/>
                    </ConsignURL>
                  </Lines>
                </xsl:if>
              </xsl:for-each>
            </ns2:MT_Tracking>
          </ns0:Message2>
        </ns0:Messages>
      </xsl:template>
    </xsl:stylesheet>

    Hi Hareesh,
    Please find my determination in the XSLT below, I am using enhanced receiver determination.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:p1="http://sap.com/xi/XI/System" xmlns:ns="urn:sap-com:document:sap:idoc:messages" version="1.0">
      <xsl:variable name="vFlag"/>
      <xsl:variable name="vAX" select="0"/>
      <xsl:variable name="vSAP" select="0"/>
      <xsl:variable name="vBoth" select="0"/>
      <!--  <xsl:variable name="vPONUM" select="POTRACKING/Lines[1]/PONumber"/>-->
      <xsl:template match="/">
        <xsl:for-each select="POTRACKING/Lines">
          <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">
            <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>
            <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>
          </sap:call-external>
          <xsl:choose>
            <xsl:when test="$vFlag = 0">
              <!--          <p1:Receivers>
                <Receiver>
                  <Service>
                    <xsl:text>BS_AXAPTA_TST</xsl:text>
                  </Service>
                </Receiver>
              </p1:Receivers>-->
              <xsl:variable name="vAX" select="$vAX + 1"/>
            </xsl:when>
            <xsl:when test="$vFlag = 1">
              <!--          <p1:Receivers>
                <Receiver>
                  <Service>
                    <xsl:text>BS_ECQCLNT300</xsl:text>
                  </Service>
                </Receiver>
              </p1:Receivers>-->
              <xsl:variable name="vSAP" select="$vSAP + 1"/>
            </xsl:when>
          </xsl:choose>
        </xsl:for-each>
        <xsl:if test="$vSAP &gt; 0">
          <xsl:if test="$vAX &gt; 0">
            <xsl:variable name="vBoth" select="$vBoth + 1"/>
            <xsl:variable name="vSAP" select="0"/>
            <xsl:variable name="vAX" select="0"/>
          </xsl:if>
        </xsl:if>
        <xsl:if test="$vBoth &gt; 0">
          <p1:Receivers>
            <Receiver>
              <Service>
                <xsl:text>BS_AXAPTA_TST</xsl:text>
              </Service>
            </Receiver>
            <Receiver>
              <Service>
                <xsl:text>BS_ECQCLNT300</xsl:text>
              </Service>
            </Receiver>
          </p1:Receivers>
        </xsl:if>
        <xsl:if test="$vAX &gt; 0">
          <p1:Receivers>
            <Receiver>
              <Service>
                <xsl:text>BS_AXAPTA_TST</xsl:text>
              </Service>
            </Receiver>
          </p1:Receivers>
        </xsl:if>
        <xsl:if test="$vSAP &gt; 0">
          <p1:Receivers>
            <Receiver>
              <Service>
                <xsl:text>BS_ECQCLNT300</xsl:text>
              </Service>
            </Receiver>
          </p1:Receivers>
        </xsl:if>
      </xsl:template>
    </xsl:transform>

  • XSLT Mapping issue. If condition.

    Hi,
    A and B are in Source Structure.   "C" is in Target Structure.
    If "A"  value has between 5001 and 6999 then pass "B" to C.
    How to do this in XSLT map?
    Thanks
    Deepthi

    Code:
    - <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    - <xsl:for-each select="POS/Detail">
    - <xsl:if test="(POS/Detail/FieldA > 5000) and (POS/Detail/FieldA < 7000)">
    - <xsl:call-template name="insert_E1WPF02">
      <xsl:with-param name="ReferenceNo" />
      <xsl:with-param name="ItemNo" />
      <xsl:with-param name="Amount" />
      </xsl:call-template>
      </xsl:if>
      </xsl:for-each>
    - <xsl:template name="insert_E1WPF02" match="/">
      <xsl:param name="ItemNo" />
      <xsl:param name="Amount" />
      <xsl:param name="RefernceNo" select="POS/Detail/FieldB" />
    - <ZUONR>
      <xsl:value-of select="$ReferenceNo" />
      </ZUONR>
    - <POSNR>
      <xsl:value-of select="$ItemNo" />
      </POSNR>
    - <WRBTR>
      <xsl:value-of select="$Ammount" />
      </WRBTR>
      </xsl:template>
      </xsl:stylesheet>
    I Cannot use  <xsl:template name="insert_E1WPF02> twice because it is creating 2 E1WPF02 Segments in Idoc for each transaction which is not correct.

  • Xslt conditional to limit words in a feed

    I'm trying to use XSLT in DW to do a news feed and can't
    figure out how to limit the number of words in the description. I'm
    using David Power's book as an example. I'm showing the Titles as
    links and the Descriptions fine and can limit the number of objects
    to display. But I can't figure out how to limit the number of words
    in the Descriptions. I want to display the feed in a sidebar and
    just show the first couple of lines from the description as a
    teaser.
    Any suggestions appreciated.

    Bob Timms wrote:
    > I'm trying to use XSLT in DW to do a news feed and can't
    figure out how to
    > limit the number of words in the description.
    My knowledge of XSLT is pretty basic, so I can't suggest a
    way to select
    a specific number of words. However, it's very easy to select
    the first
    sentence. The following example cuts off the contents of a
    <description>
    tag at the first period followed by a space, and adds an
    ellipsis:
    <xsl:value-of select="substring-before(description, '.
    ')"/>
    <xsl:text>...</xsl:text>
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS4",
    "PHP Solutions" & "PHP Object-Oriented Solutions"
    http://foundationphp.com/

  • How to give if condition in XSLT for the below issue

    I have a customer order in .Txt which is picked by my FTP process & in mediator mapping will be done. Here i have an issue where the Txt file is in delimiter file it is having Customer Order number(CON) in each line of a single record,now i have to ignore the CON and to pic all the other details of the same Order. Here in the below i'm placing the sample file. where each order no. is repeated along with remaining details of same order. My problem is when i deployed each CON of line is taking as a single order., after reading CON details once it should jump to new CON. In this Stock code & Quantity are changing, so it should pic this excluding CON in each line.
    Customer order number;Order Date;Stock code;Quantity;Leverans adress namn;Leverans adress rad 1;Leverans adress rad 2;Leverans adress rad 3;Postnummer;Stad;ButiksID
    "61068344";"31-01-11";"02716Z0";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"99H10048-00";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"99H10046-00";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"100-99150000-60";"4";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"0278812";"2";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"534970";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068373";"31-01-11";"1234-0433";"1";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"100-92080000-60";"30";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"0138";"40";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"CM011674";"40";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"CM012044";"10";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"IC416";"30";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"1230-1847";"10";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"99H10046-00";"2";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"CPW012602";"30";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"

    Here i missed one thing to say, After reading all the fields from first record of CON the Stock_Code & Quantity to be picked and added in the same record from next line of CON untill the CON is changed. For this can we do with NXSD file? using which option can we use this? & how can we complete this in XSLT?

  • How can I display XSLT transformer errors on a web page ?

    Hi,
    I have some JSP pages that access DB, create an XML based on DB data and then transform it into HTML through an XSLT stylesheet. Developing the XSL code it's easy to make mistakes and generate errors on trasformation, but what I receive on the web page is only a "Could not compile stylesheet" TransformerConfigurationException, while the real cause of the error is displayed only on tomcat logs. This is the code for transformation:
    static public void applyXSLT(Document docXML, InputStream isXSL, PrintWriter pw) throws TransformerException, Exception {
            // instantiate the TransformerFactory.
            TransformerFactory tFactory = TransformerFactory.newInstance();
            // creates an error listener
            XslErrorListener xel = new XslErrorListener();
            // sets the error listener for the factory
            tFactory.setErrorListener(xel);
            // generate the transformer
            Transformer transformer = tFactory.newTransformer(new SAXSource(new InputSource(isXSL)));
            // transforms the XML Source and sends the output to the HTTP response
            transformer.transform(new DOMSource(docXML), new StreamResult(pw));
    }If an exception is thrown during the execution of this code, its error message is displayed on the web page.
    This is the listener class:
    public class XslErrorListener implements ErrorListener {
        public XslErrorListener() {
        public void warning(TransformerException ex) {
            // logs on error log
            System.err.println("\n\nWarning on XEL: " + ex.getMessage());
        public void error(TransformerException ex) throws TransformerException {
            // logs on error log
            System.err.println("\n\nError on XEL: " + ex.getMessage());
            // and throws it
            throw ex;
        public void fatalError(TransformerException ex) throws TransformerException {
            // logs on error log
            System.err.println("\n\nFatal Error on XEL: " + ex.getMessage());
            // and throws it
            throw ex;
    }When I have an error in the XSL stylesheet (for examples a missing closing tag), I can find on tomcat logs the real cause of the error:
    [Fatal Error] :59:10: The element type "table" must be terminated by the matching end-tag "</table>".
    Error on XEL: The element type "table" must be terminated by the matching end-tag "</table>".but on my web page is reported just the TransformerConfigurationException message that is:
    "Could not compile stylesheet".
    How can I display the real cause of the error directly on the web page?
    Thanks,
    Andrea

    This code is part of a bigger project that let developers edit XSL stylesheets through a file upload on the system and we can't impose the use of any tool for checking the xsl. So, I need to display the transformer error on the web page.I see. This code is part of an editorial/developmental tool for developers to create and edit XSL stylesheets.
    As part of the editorial process, XSL errors during editing can be considered a normal condition. In other words, it is normal to expect that the developers will generate XSL errors as they are developing stylesheets.
    In this light, handling the XSL transformation errors is a business requirement that you need to handle. Using the Java Exceptions mechanisms, e.g. try / catch are inappropriate to handle business requirements, in my opinion.
    I suggest that you look at how you handle the occurence of XSL errors differently than what you currently have. You need to:
    (1) capture the Transformation exception on the server;
    (2) extract the message from the exception and put it into a message that can be easily understood by the user;
    The current error message that you have going to the web browser is not useful.
    And you should not have the Transformation exception sent to the web browser either.
    What you are attempting to do with the exception is not appropriate.
    Handle the Transformation exception on the Business tier and use it to create a useful message that is then sent to the Presentation tier. In other words, do not send Java exceptions to web browser.
    />

  • Filter Idoc segment based on date in XSLT map

    Hi,
    In a Idoc to flat file XSLT mapping, I have a requirment to filter segment out of multiple segment occurance in HRMD_A idoc. Idoc has two date fields(actually string data, containing date in YYYYMMDD format) in the segment(end date and start date). I need to filter only one segment from multiple segments where current date falles within start and end dates (end date >= current date >= start date). Then map output fields from the filtered segment.
    Its easy doing it in graphical mapping, but its difficult to use graphical mapping here as the message structure are enormous. I dont have much hands on in XSLT but think many of you have been through this kind of requirement using XSLT. So holding my hope high :). Please suggest a logic for this, will be highly appretiated.
    Regards
    Suman.

    This functions will give you the current date:
    fn:current-dateTime()     => Returns the current dateTime (with timezone)
    fn:current-date()                 => Returns the current date (with timezone)
    fn:current-time()                 => Returns the current time (with timezone)
    To compare:
    fn:compare(comp1,comp2)
    fn:compare(comp1,comp2,collation)
    => Returns -1 if comp1 is less than comp2, 0 if comp1 is equal to comp2, or 1 if comp1 is greater than comp2 (according to the rules of the collation that is used)
    Example: compare('ghi', 'ghi')
    Result: 0
    Also I suggest working with an IF condition like this:
    <xsl:if test="price &gt; 10">
            <tr>
              <td><xsl:value-of select="title"/></td>
              <td><xsl:value-of select="artist"/></td>
            </tr>
          </xsl:if>
    Edited by: Kai Lerch-Baier on Apr 14, 2009 10:21 AM

Maybe you are looking for