XSLT Sort Issues

I have an XML document that give me a list of PO lines and orders. When I get the PIX message I want to sort it by PO number and then PO Line. For some reason my syntax below isn't working. I need to sort by Reference2 then Reference4. I tried to just get 4 to work but that wasn't working either.
<xsl:template match="/">
<xsl:for-each select="tXML/Message/PIX">
<xsl:sort select="PIXFields/Reference4"/>
     <xsl:apply-templates select="."/>     
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<tXML>
     <Message>
          <PIX>
               <TransactionType>603</TransactionType>
               <TransactionCode>02</TransactionCode>
               <TransactionNumber>10731</TransactionNumber>
               <SequenceNumber>1</SequenceNumber>
               <PIXFields>
                    <DateCreated>11/29/12 13:25 EST</DateCreated>
                    <ReferenceCode1>104</ReferenceCode1>
                    <Reference1>ASN1769527</Reference1>
                    <ReferenceCode2>108</ReferenceCode2>
                    <Reference2>1769527</Reference2>
                    <ReferenceCode3>107</ReferenceCode3>
                    <ReferenceCode4>43</ReferenceCode4>
                    <Reference4>7.000</Reference4>
               </PIXFields>
          </PIX>
          <PIX>
               <TransactionType>603</TransactionType>
               <TransactionCode>02</TransactionCode>
               <TransactionNumber>10731</TransactionNumber>
               <SequenceNumber>2</SequenceNumber>
               <PIXFields>
                    <DateCreated>11/29/12 13:25 EST</DateCreated>
                    <ReferenceCode1>104</ReferenceCode1>
                    <Reference1>ASN1769527</Reference1>
                    <ReferenceCode2>108</ReferenceCode2>
                    <Reference2>1769527</Reference2>
                    <ReferenceCode3>107</ReferenceCode3>
                    <ReferenceCode4>43</ReferenceCode4>
                    <Reference4>7.000</Reference4>
               </PIXFields>
          </PIX>
          <PIX>
               <TransactionType>603</TransactionType>
               <TransactionCode>02</TransactionCode>
               <TransactionNumber>10731</TransactionNumber>
               <SequenceNumber>3</SequenceNumber>
               <PIXFields>
                    <DateCreated>11/29/12 13:25 EST</DateCreated>
                    <ReferenceCode1>104</ReferenceCode1>
                    <Reference1>ASN1769527</Reference1>
                    <ReferenceCode2>108</ReferenceCode2>
                    <Reference2>1769527</Reference2>
                    <ReferenceCode3>107</ReferenceCode3>
                    <ReferenceCode4>43</ReferenceCode4>
                    <Reference4>3.000</Reference4>
               </PIXFields>
          </PIX>
          <PIX>
               <TransactionType>603</TransactionType>
               <TransactionCode>02</TransactionCode>
               <TransactionNumber>10731</TransactionNumber>
               <SequenceNumber>4</SequenceNumber>
               <PIXFields>
                    <DateCreated>11/29/12 13:25 EST</DateCreated>
                    <ReferenceCode1>104</ReferenceCode1>
                    <Reference1>ASN1769527</Reference1>
                    <ReferenceCode2>108</ReferenceCode2>
                    <Reference2>1769527</Reference2>
                    <ReferenceCode3>107</ReferenceCode3>
                    <ReferenceCode4>43</ReferenceCode4>
                    <Reference4>6.000</Reference4>
               </PIXFields>
          </PIX>
          <PIX>
               <TransactionType>603</TransactionType>
               <TransactionCode>02</TransactionCode>
               <TransactionNumber>10731</TransactionNumber>
               <SequenceNumber>5</SequenceNumber>
               <PIXFields>
                    <DateCreated>11/29/12 13:25 EST</DateCreated>
                    <ReferenceCode1>104</ReferenceCode1>
                    <Reference1>ASN1769527</Reference1>
                    <ReferenceCode2>108</ReferenceCode2>
                    <Reference2>1769527</Reference2>
                    <ReferenceCode3>107</ReferenceCode3>
                    <ReferenceCode4>43</ReferenceCode4>
                    <Reference4>10.000</Reference4>
               </PIXFields>
          </PIX>
          <PIX>
               <TransactionType>603</TransactionType>
               <TransactionCode>02</TransactionCode>
               <TransactionNumber>10731</TransactionNumber>
               <SequenceNumber>6</SequenceNumber>
               <PIXFields>
                    <DateCreated>11/29/12 13:25 EST</DateCreated>
                    <ReferenceCode1>104</ReferenceCode1>
                    <Reference1>ASN1769527</Reference1>
                    <ReferenceCode2>108</ReferenceCode2>
                    <Reference2>1769527</Reference2>
                    <ReferenceCode3>107</ReferenceCode3>
                    <ReferenceCode4>43</ReferenceCode4>
                    <Reference4>2.000</Reference4>
               </PIXFields>
          </PIX>
     </Message>
</tXML>

This is usually achieved with a classic identity transformation, amended with a special template to process element(s) of interest :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="node()">
    <xsl:copy>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="Message">
    <xsl:copy>
      <xsl:apply-templates select="PIX">
        <xsl:sort select="PIXFields/Reference2" data-type="number"/>
        <xsl:sort select="PIXFields/Reference4" data-type="number"/>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Similar Messages

  • XSLT mapping issue in parent child relation

    Hi Guys,
    i have one XSLT mapping issue. Mapping scenario is from IDoc to file.
    IDoc structure is as below
    <ZLOIPRO1>
      <E1AFKOL>
         <A></A>
         <B></B>
         <E1RESBL>
             <MATNR>1</MATNR>
             <CHARG>1</CHARG>
             <ZSBL>
                 <MTART>ABC</MTART>
             </ZSB>
         </E1RESBL>
         <E1RESBL>
             <MATNR>2</MATNR>
             <CHARG>2</CHARG>
             <ZSBL>
                 <MTART>ZHA1</MTART>
             </ZSB>
         </E1RESBL>
         <E1RESBL>
             <MATNR>3</MATNR>
             <CHARG>3</CHARG>
             <ZSBL>
                 <MTART>ZHA1</MTART>
             </ZSB>
         </E1RESBL>
      </E1AFKOL>
    </ZLOIPRO1>
    As you can see 'E1RESBL' is repeatative. Now my issue is i need to select 'MATNR' and 'CHARG' from 'E1RESBL' segment when first occurance of 'ZSBL/MTART' with value 'ZHA1' appears. i.e. my output would be MATNR = 2 and CHARG = 2.
    I hope i am clear. Please let me know if any solution for this.

    Hi,
    Try this
    <xsl:if test="./ZSBL/MTART == 'ZHA1'">
    <xsl:for-each select="./E1RESBL">
      <MATNR>
       <xsl:value-of select="./MATNR"/>
      </MATNR>
      <BATCH>
       <xsl:value-of select="./CHARG"/>
      </BATCH>
    </xsl:for-each>
    </xsl:if>
    You might need to do some changes in the above.
    Thanks,
    Prakash

  • Sorting issue after upgrade from 9i to 10g

    Dear all,
    It is found that the sorting behavior is different after upgrade from 9i to 10g.
    In 9i, even if the SQL statement does not specify the ORDER BY clause, the sorting order is consistent for a particular SQL statement and most likely the sequence follows the searched key fields' order.
    After upgrade to 10g, the query output could vary as long as the SQL statement does not specify the ORDER BY clause.
    Is it due to the Reverse Docid Sorting issue? How can I troubleshoot this issue?
    Thanks for your help,
    M.T.

    903714 wrote:
    Dear all,
    It is found that the sorting behavior is different after upgrade from 9i to 10g.
    In 9i, even if the SQL statement does not specify the ORDER BY clause, the sorting order is consistent for a particular SQL statement and most likely the sequence follows the searched key fields' order.
    After upgrade to 10g, the query output could vary as long as the SQL statement does not specify the ORDER BY clause.
    Is it due to the Reverse Docid Sorting issue? How can I troubleshoot this issue?
    Thanks for your help,
    M.T. This is expected behavior in 10g. Oracle will not order the dataset for you unless and until you explicitly specify it.
    So without using order by clause in 10g, oracle doesn't guarantee that rows will be ordered.
    To go back to old behavior like 9i, you can set a workaround by
    alter session set "_newsort_enabled"=false;
    Also see MOS - Order Of Data Retrieval Differs after upgrading 9i To 10g [ID 456707.1]

  • Query as a web service Sorting issue

    Hi All,
    We have designed an existing BI query as a web service but it seems to be ignoring the Sort order of different characteristics used (as defined in Bex Query Designer).
    Using the Context menu in QAAS and defining/managing the Sort is not working.
    Has anyone experienced such an issue and how to handle this?
    Thanks and Regards,
    Bansi

    Hi All,
    You can try this solution. It has something to do with the universe parameter, END_SQL.
    I implemented this as a work around and it solved our problem about the sorting issue with QAAWS.
    Here are the steps:
    1: Open the universe
    2. Ope File,  then Universe Parameter
    3. Click the parameter tab
    4. Scroll down until you see the 'END_SQL' entry. This entry is blank by default.
    5. Select END_SQL
    6. On the VALUE box, type: ORDER BY 1
    7. This will enable the REPLACE button. Click REPLACE
    8. Save the universe
    9 Test a query using 2 columns and view the SQL.
    You should see now the ORDER BY 1 inferred in the SQL statement.
    Voila!!!!
    Of course you can always add ORDER By 1,2,3 later if there's a need.
    Enjoy.....
    Ferdinand

  • Finder sort issue

    I seem to be having a sorting issue.
    This order seems odd to me, but like to get your opinions about it.
    (This folder is sorted alphabetically by file name.)
    2008 01.doc
    2008 02.doc
    Activiteit_oktober.doc
    af 200802 - groen reserve.rtf
    af 200802 - groen.rtf
    af 20071130 - groen-geel.doc
    af 20080126 - groen.rtf
    af 20080216 avond - leiding WE.pages
    af 20080704 avond - groen & oranje.pages
    af 20080709 avond - bezinning.rtf
    idee spel.rtf
    In my logic the file 'af 20071130 - groen-geel.doc' should be before the two files beginning with 'af 200802' and not after. Or is this just me?

    In my logic the file 'af 20071130 - groen-geel.doc' should be before the two files beginning with 'af 200802' and not after. Or is this just me?
    OS X Finder sorts strings of digits according to their value, not digit by digit. 200802 is less than 20071130. Here is a note on the issue:
    http://homepage.mac.com/thgewecke/sorting.html

  • Front Row sorting issues

    Hello,
    I know this issue has been posted several times and without any real solutions. But I'm going to ask again anyway in case the magical hacking gnomes have found a work-around.
    I have many sorting issues. There seems to be a lot of kvetching on here already about how Front Row sorts TV shows. But not only do my shows come up backwards within seasons, in some cases seasons themselves are out of order. For example, I have all 3 seasons of 30 Rock (purchased through iTMS) and they go season 1, season 3, season 2. Several other shows with multiple seasons are the same.
    But I also have a music sorting issue. The first part of this issue has to do with compilations. I've got several compilations in my library, and in iTunes I've sorted them by Various Artists rather than individual artists. In Front Row, if I scroll down to "V," there is no "Various Artists" like you might expect but instead a list of all the artists in all the compilations completely out of order. (Actually, they're ordered by their track number on the different albums. Yeah. That makes sense.) I could deal with these artists showing up in their normal places alphabetically, but not all lumped together under V.
    The other issue has to do with albums with one artist who has some tracks that feature other artists. Kanye West's "Graduation" is a good example. About half the tracks on the album are him "featuring Jamie Foxx," for example. So I put "Kanye West" in the sort field of this album so it displays properly in iTunes. Not only does this seem to have no effect on how things are sorted in Front Row, but there's actually multiple "Kanye West"s now, each one identical, as well as multiple "Kanye West feat. Jamie Foxx," lines and all the other multiple artist track. Uh...what?
    So I know that Front Row for some ridiculous reason is (a) not customizable and (b) operates under completely different sorting rules than iTunes (which makes no sense), but if anyone has any advice or tips or comments or whatever, that would be greatly appreciated.
    I've considered switching to a different media management program, but what I like about Front Row is its simplicity. I don't really feel like learning a whole new system (let alone getting my wife to buy into that idea). I've got better ways to spend my time. So, it's a trade off, I guess.
    Anyway, Apple Gods? Are you out there? Are you listening?

    I can't believe we're still banging on about the sorting problems. Apple have seen fit to provide a number of features to allow the user to get iTunes working the way they like, e.g. grouping compilation artists and the use of sort fields. I think you can now even keep compilation artists grouped on the iPod. But why oh why do they then totally ignore this for the AppleTV and Front Row (which look like the same codebase to me)?
    I have hundreds of genuine Artists that I want to see listed in the Artists' list, but not the thousands of others that appear on compilations. They don't even sort the artists by the Artist Sort field that they themselves provide in iTunes. This makes a nonsense of trying to use either the ATV or Front Row.
    Playlists are no help as they simply lump all contained tracks in one great list. Useless.
    The annoying thing is, they can get it right. iTunes just gets better and better in this regard, each release sorting out more of the omissions of earlier versions. But ATV and Front Row - nope, nothing. Still just as stupid as always. Just what will it take to convince Apple to 'sort' (ha) this out? How can they justify such entirely different ways of working on their different products?

  • XQuery sorting issue

    Hi,
    Right now I am in a big trouble. I am new in XQuery, but right now I'm in a project using Xquery using PHP and XSLT..
    In our project we have large no. data (its a property listing site) and I'm storing that data to Berkeley DB (XML DB). The problem is when I am searching for a property its taking too much time for getting the result. The ORDER BY is creating the problem(Query 1).. with out sorting its working fine(Query 2). But for my project sorting is needed and its very impotent. So kindly please check my query(Query1) and please give me a solution as soon as possible. Following are the query:
    Query1:
    let $properties := (
    for $property in collection('bdb/properties.dbxml')/properties/property
    [( sale_price >=60000 and sale_price <=500000 ) and ( building_square_footage >=300 and building_square_footage <=3000 ) and ( bedrooms >=2 and bedrooms <=6 )]
    order by
    contains($property/mls_agent_id/text(), '505199') descending,
    matches($property/mls_office_id/text(), '^CBRR') ascending,
    $property/sale_price/number() descending
    return $property
    let $properties := subsequence($properties,10,10) return <properties>{$properties}</properties>
    Query 2:
    let $properties := (
    for $property in subsequence (
    collection('bdb/properties.dbxml')/properties/property
    [( sale_price >=60000 and sale_price <=500000 ) and ( building_square_footage >=300 and building_square_footage <=3000 ) and ( bedrooms >=2 and bedrooms <=6 )]
    , 1, 10)
    descending return $property
    ) return <properties>{$properties}</properties>
    Thank you,
    Vijesh
    Edited by: 893736 on Oct 28, 2011 10:28 AM
    Edited by: 893736 on Oct 28, 2011 10:33 AM

    Hi,
    Thank you for your reply.. right now there is a slight improvement in Query. But still i'm stucked with issue... also this project is also stucked...
    Now the problem is when I am searching for a property it will list the first 10 property quickly(100% speed). Then I'm going to 2dn, 3rd page its working in the same speed. But if I'm going to 10th(30% speed) or 100th or 1500th(15%speed) page is working very slowly.
    Following are my query:
    let $property_ids:=
    for $property in collection('bdb/properties.dbxml')/properties/property
    order by $property/sale_price/number() descending
    return $property/@property_id,
    for $property in collection('bdb/properties.dbxml')/properties/property
    order by $property/sale_price/number() descending
    return $property/@property_id,
    for $property in collection('bdb/properties.dbxml')/properties/property
    order by $property/sale_price/number() descending
    return $property/@property_id
    return <properties>{
    for $id in subsequence($property_ids, 1, 10) return
    collection('bdb/properties.dbxml')/properties/property@property_id = $id
    }</properties>
    And some times query will change like the following way based on the filter option in my page(means sort by only sale_price field):
    let $property_ids:=
    for $property in collection('bdb/properties.dbxml')/properties/property
    order by $property/sale_price/number() descending
    return $property/@property_id
    return <properties>{
    for $id in subsequence($property_ids, 1, 10) return
    collection('bdb/properties.dbxml')/properties/property@property_id = $id
    }</properties>
    then from the first page its self its performance is very slow(15%).
    Could you please check my query and help me to solve the issue...
    Thank you,
    Vijesh

  • Cover flow and album sort issues

    I just got a 80GB iPod classic for Christmas and I have noticed some annoying differences between iTunes cover flow and iPod cover flow:
    1. In iTunes cover flow, when you have songs with "Unknown Album", they clutter up the cover flow for each artist. In iPod cover flow, they are sent to the back of the cover flow in a nice little "Various Artists" cover. I like how this works on the iPod better.
    2. iTunes cover flow sorts by album artist, so you don't see a separate album for each non-album artist song.
    For example: If I set my album artist for the Saturday Night Fever soundtrack to "Saturday Night Fever" (don't ask why, this is how i like it sorted) then I will only see one "Saturday Night Fever" rather than one for Bee Gees, one for Kool & the Gang, etc.
    iPod cover flow sorts by artist, so you see a separate album for each non-album artist song. I like the way this works in iTunes better.
    3. When sorting by "Album by Year" in iTunes, syncing the iPod doesn't seem to follow the same sorting. Albums are still sorted on the iPod alphabetically. I want them to sort by year on my iPod.
    So I would appreciate it if someone could help me with all 3 of these issues. As you can see, sometimes iTunes is better for me, sometimes iPod is better for me.

    3. Playlists should be sorted in the same way as they are in iTunes. The Cover Flow order is fixed.
    This is not the case, at least not with iTunes 7.5.0.20 and my 80GB Classic running 1.0.3 on it (current version as of this writing). In iTunes, under LIBRARY, I select Music, and I have my music sorted via *Album by Year*. This works perfectly in iTunes. I'll use my Soundgarden library as an example, as it shows the problem nicely.
    *_iTunes order_:*
    Ultramega OK
    Louder Than Love
    Screaming Life/Fopp
    Badmotorfinger
    Superunknown
    Songs From The Superunknown
    Down on the Upside
    A-Sides
    That's ordered by date and is perfect. +Ultramega OK+ was released way back in 1988, while A-Sides was released nearly 10 years later in 1997. In Cover Flow View it works great. However, in the iPod it's sorted alphabetically, which is completely wrong:
    *_iPod Classic_:*
    A-Sides
    Badmotorfinger
    Down on the Upside
    Louder Than Love
    Screaming Life/Fopp
    Songs From The Superunknown
    Superunknown
    Ultramega OK
    This is totally wrong. And I haven't yet found a way to force it.
    Apple, please, this shouldn't be that difficult.

  • SOAP Response XSLT mapping issue

    Hi,
    Source XML.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Create__CompIntfc__APC_WORKER2_CIResponse xmlns:ns0="http://peoplesoft.com/APC_WORKER2_CI">
       <ns0:notification>y</ns0:notification>
       <ns0:detail>
          <ns0:keyinformation>
             <ns0:PERSON_ID/>
             <ns0:SUBMIT_DATE/>
             <ns0:ACTION/>
          </ns0:keyinformation>
          <ns0:messages>
             <ns0:type/>
             <ns0:messagesetnumber/>
             <ns0:messagenumber/>
             <ns0:messagetext/>
             <ns0:explaintext/>
          </ns0:messages>
       </ns0:detail>
    </ns0:Create__CompIntfc__APC_WORKER2_CIResponse>
    Target XML
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:Z_HPA_357_PROVISION_USER_IMS.Response xmlns:ns1="urn:sap-com:document:sap:rfc:functions"><SUCCESS>y</SUCCESS></ns1:Z_HPA_357_PROVISION_USER_IMS.Response>
    XSLT Mapping
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ns1="http://authserv.apc.com/peoplesoft">
      <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
      <xsl:template match="/">
        <ns1:Z_HPA_357_PROVISION_USER_IMS.Response xmlns:ns1="urn:sap-com:document:sap:rfc:functions">
          <SUCCESS>
            <xsl:value-of select="soap:Create__CompIntfc__APC_WORKER2_CIResponse/a:notification" />
          </SUCCESS>
        </ns1:Z_HPA_357_PROVISION_USER_IMS.Response>
      </xsl:template>
    </xsl:stylesheet>
    Can somebody help to figure out the issue in higlighted area of XSLT mapping.
    We just need to move "notification" value to "SUCCESS" value of RFC.
    thanks.
    santosh,.

    Hi Santosh,
    add the source namespace with a prefix:
    xmlns:ns0="http://peoplesoft.com/APC_WORKER2_CI"
    do it most simple generic without path
    do not forget the prefix
    ns0:
    use xsl:value-of:
    xsl:value-of select="//ns0:notification"
    Regards,
    Udo

  • XSLT grouping issue

    Hi,
    We have SAP webAS 6.2.  I am trying to group the authors based on their name for each publisher. But I am getting wrong results. Can someone help me understand what I am doing wrong.
    Thanks,
    Suman
    Source XML
    <?xml version="1.0" encoding="utf-8"?>
    <PublisherList>
        <publisher>
            <name>Penguin</name>
            <books>
                <book>
                    <title>Title One</title>
                    <author>David</author>
                </book>
                <book>
                    <title>Title Two</title>
                    <author>John</author>
                </book>
                <book>
                    <title>Title Three</title>
                    <author>John</author>
                </book>
                <book>
                    <title>Title Four</title>
                    <author>David</author>
                </book>
            </books>
        </publisher>
        <publisher>
            <name>Wrox</name>
            <books>
                <book>
                    <title>Title Five</title>
                    <author>David</author>
                </book>
                <book>
                    <title>Title Six</title>
                    <author>John</author>
                </book>
                <book>
                    <title>Title Seven</title>
                    <author>John</author>
                </book>
                <book>
                    <title>Title Eight</title>
                    <author>David</author>
                </book>
            </books>
        </publisher>
    </PublisherList>
    Transformation xslt:
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" indent="yes"/>
      <xsl:key name="Author" match="publisher/books/book" use="author"/>
      <xsl:template match="PublisherList">
        <List>
         <xsl:apply-templates select="publisher/books"/>
        </List>
      </xsl:template>
      <xsl:template match="books">
        <xsl:for-each select="book[generate-id(.) = generate-id(key('Author', author)[1])]">
          <xsl:sort select="author"/>
          <BookPublisher>
            <name>
              <xsl:value-of select="//parent::node()[name()='publisher']/name"/>
            </name>
            <BooksByAuthor>
              <AuthorName><xsl:value-of select="author"/></AuthorName>
             <xsl:for-each select="key('Author', author)">
              <title>
                <xsl:value-of select="title"/>
              </title>
            </xsl:for-each>
            </BooksByAuthor>
          </BookPublisher>
        </xsl:for-each>
      </xsl:template>
    </xsl:transform>
    Expected Result:
    <?xml version="1.0" encoding="UTF-8"?>
    <List>
        <BookPublisher>
            <name>Penguin</name>
            <BooksByAuthor>
                <AuthorName>David</AuthorName>
                <title>Title One</title>
                <title>Title Four</title>
            </BooksByAuthor>
            <BooksByAuthor>
                <AuthorName>John</AuthorName>
                <title>Title Two</title>
                <title>Title Three</title>
            </BooksByAuthor>
        </BookPublisher>
        <BookPublisher>
            <name>Wrox</name>
            <BooksByAuthor>
                <AuthorName>David</AuthorName>
                <title>Title Five</title>
                <title>Title Eight</title>
            </BooksByAuthor>
            <BooksByAuthor>
                <AuthorName>John</AuthorName>
                <title>Title Six</title>
                <title>Title Seven</title>
            </BooksByAuthor>
        </BookPublisher>
    </List>
    Actual Result from my xslt:
    <?xml version="1.0" encoding="UTF-8"?>
    <List>
        <BookPublisher>
            <name>Penguin</name>
            <BooksByAuthor>
                <AuthorName>David</AuthorName>
                <title>Title One</title>
                <title>Title Four</title>
                <title>Title Five</title>
                <title>Title Eight</title>
            </BooksByAuthor>
        </BookPublisher>
        <BookPublisher>
            <name>Penguin</name>
            <BooksByAuthor>
                <AuthorName>John</AuthorName>
                <title>Title Two</title>
                <title>Title Three</title>
                <title>Title Six</title>
                <title>Title Seven</title>
            </BooksByAuthor>
        </BookPublisher>
    </List>

    I got the answer from MSDN forum for this.
    Here is the code
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
          <xsl:output method="xml" indent="yes"/>
          <xsl:key name="Author" match="publisher/books/book" use="author"/>
          <xsl:template match="PublisherList">
                <List>
                      <xsl:apply-templates select="publisher"/>
                </List>
          </xsl:template>
          <xsl:template match="publisher">
          <BookPublisher>
                            <name>
                                  <xsl:value-of select="name"/>
                            </name>
                <xsl:for-each select= "books/book[generate-id(.)=generate-id(key('Author', author)[../../name = current()/name][1])]">
                      <xsl:sort select="author"/>
                             <BooksByAuthor>
                                  <AuthorName>
                                        <xsl:value-of select="author"/>
                                  </AuthorName>
                                  <xsl:for-each select= "key('Author', author)[../../name = current()/../../name]">
                                        <title>
                                              <xsl:value-of select="title"/>
                                        </title>
                                  </xsl:for-each>
                            </BooksByAuthor>
                           </xsl:for-each>
                 </BookPublisher>
          </xsl:template>
    </xsl:transform>

  • XSLT substring issue

    Hi All,
    I've got XSLT issue.
    Suppose in XML I have string like that :
    world.country.town.Moskow.SomeOtherValue
    Capitalized word/s/ is/are/ always at the end.
    Using XSLT how to get substring returning capitalized words only i.e Moskow.SomeOtherValue
    Thanks

    Hi,
    Here are two possible solutions :
    1) If you can run XSLT 2.0, then you may use a regular expression :
    Sample XML :
    <test>world.country.town.Moskow.SomeOtherValue</test>
    <?xml version="1.0"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:template match="/">
    <xsl:analyze-string select="test" regex="\.([A-Z].*)$">
      <xsl:matching-substring>
        <result><xsl:value-of select="regex-group(1)"/></result>
      </xsl:matching-substring>
    </xsl:analyze-string>
    </xsl:template>
    </xsl:stylesheet>
    output :
    <result>Moskow.SomeOtherValue</result>2) With XSLT 1.0, you can use a recursive template to analyze the string :
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:template match="/">
      <result>     
        <xsl:call-template name="find_cap_words">
          <xsl:with-param name="in" select="test"/>
        </xsl:call-template>
      </result>
    </xsl:template>
    <xsl:template name="find_cap_words">
      <xsl:param name="in"/>
      <xsl:variable name="rem" select="substring-after($in,'.')"/>
      <xsl:choose>
        <xsl:when test="translate(substring($rem,1,1),'_ABCDEFGHIJKLMNOPQRSTUVWXYZ','_')=''">
              <xsl:value-of select="$rem"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="find_cap_words">
            <xsl:with-param name="in" select="$rem"/>
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>
    output :
    <result>Moskow.SomeOtherValue</result>Hope that helps.

  • XSLT Tag issue

    Hi All,
    I am using following in my XSLT mapping but XML parser is not recognizing the  < tag:
    <xsl:text disable-output-escaping="yes"><![CDATA[< K K >]]></xsl:text>
    I have even tired the &lt; but still it throw the XML is not well formatted error. Please advice.
    Thanks.

    Hi,
    sorry, but this seems to be a BC-XI issue, not an MM issue.
    Regards,
    Edit

  • Payment Advice Sort Issue

    Hi All,
      We are having an issue with the way the payment advices are sorted for our canadian company when running DME. We set a sort variant based on Payee name on REGUH which is ZNME1, but that field has <b>Firstname Lastname</b> so all the sort is done based on first name. We want to do it based on last name but there no field on REGUH which will help us.
    Kindly advice.
    Regards,
    S

    Hi Javed
    Please let me know if you have implemented any solution to this. We are facing the same issue.
    Regards
    Rajesh

  • Index (HHK) sorting issue in Japanese (RoboHelp X3)

    I'm a Japanese localizing engineer who now tries to generate
    a WebHelp with a nicely sorted index in Japanese.
    As I assume that this has been a known issue for double-byte
    languages for a long time, a Japanese index cannot be sorted
    perfectly in a compiled chm or WebHelp. In Japanese, there are
    several types of Japanese characters (Kanji, Katakana, Hiragana).
    Regardless of what type of character a string is typed in, Japanese
    strings should be sorted according to <i>yomi-gana</i>,
    the way each Japanese string pronounces but currently an index gets
    sorted according to the following order (in ASCII code):
    *number
    *alphabet
    *hiragana
    *katanaka
    *kanji... and so on.
    So here I'm trying to do the followings:
    1. In a HHK file, I put <so>...</so> in front of
    every entry where I spell out the pronounciation in each <so>
    segment.
    2. Open the HHK with HTML Workshop, sort the file, and save
    it (I'll get the file sorted according to what I have put in
    <so>..</so>.
    3. Open it with a Text Editor and remove all the
    <so>..</so> entrires.
    4. Put the HHK file in a build folder and generate a
    chm/WebHelp in RoboHelp X3.
    In the 4th step, I don't want RoboHelp to re-sort the HHK but
    it does it automatically. If I can disable the index sorting
    functionality in RoboHelp X3 (the latest version in Japanese) but
    looks like there is no way to do it. If anyone is sure that it's
    not possible to disable the auto-sorting functionality in RoboHelp,
    please let me know so that I can give up witout a sweat.
    By the way, I have tried the alternative for WebHelp that
    skips the 3rd step and removes all the <so>...</so> in
    the files that RoboHelp creates. The result is that everything got
    messed up and some of the contents in the Index couldn't be viewed
    in a browser.
    Thanks.
    Rota.

    Hi Paul
    Have you tried just right-clicking in the index and choosing sort?
    Click the image below to view larger.
    Note that this may require you to temporarily configure Microsoft HTML Help as the primary layout and editing the Project Settings in order to allow the sort function to appear.
    Remember, you press Ctrl+Shift+? to open Project Settings. You then would turn off (or ensure it's turned off) the Binary Index feature.
    Once you have done this, you would then revert any settings that you changed to allow things to work.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Execute a query using ABAP  (XSLT transformation issue)

    Hello,
    I made the steps from this blog (part I, II and III).
    /people/durairaj.athavanraja/blog/2005/12/05/execute-bw-query-using-abap-part-iii
    When trying to run the XSLT transformation, I got the message that : XML invalid source file.
    I am not sure what are the steps for running a transformation, or running it for this case ,maybe something it's not ok. I just run it, did not provide any information.
    Any suggestions ? Did anyone use the function module described in this blog ?
    Thank you very much in advance.

    try giving
    CALL TRANSFORMATION (`ID`)
    SOURCE meta = meta_data[]
    output = <ltable>[]
    RESULT XML xml_out
    OPTIONS xml_header = 'NO'.
    and check - sometimes the codepages configured in the BW system tend to cause an issue... I am not sure if the syntax is right though - but you are basically trying to bypass any encoding that is happening in the query transformation....
    http://www.sapetabap.com/ovidentia/index.php?tg=fileman&sAction=getFile&inl=1&id=4&gr=Y&path=ABAP%2FABAPENANGLAIS&file=ABAP-XML+Mapping.pdf&idf=41
    Edited by: Arun Varadarajan on May 18, 2009 11:28 PM

Maybe you are looking for

  • Need to customize the variable info sent to a query string

    Hello, I have run into a small issue while trying to send user data selected from 1 DateField and 3 ComboBoxes in a form. Everything is sending correctly except for the DateField, when sent is places much un-needed info in the query string. For examp

  • What are "dyld" and "brtool" and why are they breaking my Lion installation?

    I have an up-to-date Snow Leopard Server installation with software RAID, and cannot complete the upgrade to Lion Server. At the "restart" step, the installation throws an error and says to try again. Here's the header from the crash report: Process:

  • How to find which displays are supported

    Is there a way that I can find out what monitors are supported in 10.5.4? Is there a file in one of the directories that shows the various drivers? I had been using my Sony KLV-S32A10 as an external monitor, and it worked fine in Leopard 10.5.2, but

  • Propper scale of an imported image

    Hi, I want to pan over a larger panorama photo (size 8000px x 1500x). If I drag this photo in the timeline, it is scaled to fit horizontally. The problem: This scaling is assumed as 100% and if I rescale it (via  Edit Effects) to fit it vertically th

  • Using Droid Incredible internationally

    I know there are a lot of different posts regarding using the HTC Droid Incredible in international CDMA locations. I am travelling to Israel which is a CDMA country. I plan on using my phone for wifi and GPS only (i have cached google maps around th