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>

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

  • Report with grouping issue

    I have a report which have year(2008), Category(0-1,2-3, ALL), product(0,1,2,3,4..), % sales. I group by all the category elements and called it as All, I am not getting the right percentage sales for the Category ALL other wise for 0-1,2-3 i am getting it right. Please advise where i am doing it wrong. please find the blog for a screen shot of my issue.
    http://ravibiblog.blogspot.com/2012/04/report-with-grouping-issue.html
    Thanks,
    RC

    Pl post details of OS, database and EBS versions. Pl see if these MOS Docs can help
    FARXPBSH Failing With "Program was terminated by signal 11" or "Program was terminated by signal 10"          (Doc ID 742729.1)
    Publishing RXAPPYAC: The FARXPBSH Ends With 'Signal 11' Error          (Doc ID 432797.1)
    RXi RX Reports Failing With Program Was Terminated By Signal 10 or 11 Errors After FA Rollup Patch 6          (Doc ID 737963.1)
    Program was Terminated by Signal 11 when Running Rxi Reports          (Doc ID 559425.1)
    HTH
    Srini

  • Sorting /Grouping Issue: Single Artist Compilation Album Doesn't Group

    iTunes 8 Sorting / Grouping Issue
    EXAMPLE
    • Album: Essential Willie Nelson
    • There are 22 songs on this Disc
    • 19 of them are labelled "Willie Nelson" in the artist field
    • 3 of them are lebelled "Willie Nelson Feat. Waylon Jennings" in the artist field
    PROBLEM
    • Album will not stay grouped together when in the standard "Sort by Artist" in Grid View. A very legitimate expectation to be able to have Willie's name listed along with his pals in the artist field and have them grouped together in one album within Willie's albums section. 19 songs group within one album in the Willie Nelson section and the other 3 are placed separately either in the compilation section or as separate albums within the regular artists grid view.
    I've read most if not all postings that suggest solutions but no matter what... they don't work. The only way that I know to work is to strip out all other names and leave only "Willie Nelson" in the Artist field. All other sorting and grouping options don't work for this issue... I've tied every combination. My opinion is that this is just a limitation at this time and there is no solution until future updates. I don't want a cheezy work-around either, that's very "unApple like". I assume it to be fixed in future updates.
    Bueller... Bueller?
    Anyone?

    There's a few other "goodies" I have found also but haven't had time to check out.
    If you have songs not in iTunes that you want to add to iTunes in a different format than the song is in...
    (This is carried over from at least 7.4)
    Set the Importing prefs to what you want the new file to be.
    Hold the Option key and go to menu Advanced and select *Convert selection to* AAC (or whatever is in the Import prefs}.
    This will add it to iTunes in the new format.
    Previously, you had to Import the file, change the prefs, go to Advanced - *Convert selection to*, convert the file, then delete the original from iTunes.
    This is new...
    In iTunes 8, go to to File - > *Show duplicates*. (moved from View menu).
    Now hold Option and go to to File and it now displays *Show exact duplicates*.
    Don't know what it means by *exact duplicate* though.

  • Group Issue

    HI Gurus,
    My client is following this scenario.It has make to Order scenario and so many subcontracting process is done by the client.
    The scenario is like,multiple work Orders are sent to Subcontract Vendor through single Group Issue.
    For Example: 5 different work orders have the same processing work and has to be carried out by SC vendor X.
    What they are doing, they donot issue the materials to the same SC vendor 5 times instead they make a group of the work Orders and issue the materials to SC at a time.
    How can we map this into SAP????????
    Thanks & Regards
    Pranaya

    Hi
    In MB1B , you can club all the PO's & issue the Goods to the SC vendor.
    Goto MB1B, enter movemnt type 541, Click on To Purchase order & enter the PO & item details. Now adopt the details & issue the Goods to SC vendor.
    Thanks & Regards
    Kishore

  • 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.

  • Grouping issue vouchers items in an invoice

    Hi all
    I'm developing an inventory and sales system , I have a master detail form for issue vouchers issued to customers, the master block contains the columns voch_no (issue voucher no) and the customer_no from issheads table and the detail block contains voch_no, stock_code,quantity and price colums from isslines table.
    Each customer may have more than one issue voucher, and each issue voucher may have more than one item.
    I have another form, the invoice form (also a master detail just like the issue voucher).
    What i hope to do is when the user creates a new invoice for a specific customer, he shouldn't create the invoice items himeself, but he should select some issue vouchers that belong to that customer (better to be multi select), then the invoice items will be created automatically to get the sum(quantity) grouping a line for each item by stock_code,price.
    The issue voucher numbers related to each invoice should be saved in a table for later updating.
    my question is :
    1-Should i create a new table that contains all the nmbers of the issue vouchers related to the invoice no ?
    2- how can i handle this in forms builder ?, should i create a new form, or can i achieve this in the invoice form itself and how?
    Please help

    Thank you!
    You're probably right, I might be talking about a feature of the sistem I'm using. Actually I'm not sure if I have access to database but probably not, I work at Xerox in Brasil and would like to know a little bit more about Oracle, with out have to ask my boss all the time. I work with record receipts of different species have lost much time trying to find repeating items on invoices. Sometimes we have interface issues, some items don't go to WIS (warehouse information system) after it registers on Oracle, so we have the physical part but it's not in the report storage
    My boss once told me he would teach me a way to see items of an invoice (repeting or not) after it registers on Oracle, but he is too busy, so I'm trying to find out by myself. If it helps, the systems responsability is Oracle applications - OSPD and my security group is standart.
    I'm sorry if my english is not that good I feel that my words seem a little confusing to you...
    Did you understand what I mean? Hope you did, and hope you can help.
    Thanks once again for your interest in helping me I really aprecciate it.
    Regards,
    Maria Carolina.

  • 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 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

  • AD security group issues in SharePoint 2013 Integrated Mode

    Hello,
    Sorry if this is the wrong forum, I'm not sure if this is a SharePoint issue or a Reporting Services configuration issue (or if it should be in a SharePoint forum regardless).
    I have SSRS2012 on SharePoint 2013 in integrated mode. We are doing item level permissions, which means we have an AD security group Reports-All with
    Read to the Reports document library, then each actual report has unique permissions. We have a report with the ProjectManagers AD
    security group on it with Read (plus some other stuff to let them manage subscriptions), and another AD security group ProjectUsers with
    just Read access so they can open the reports. The data source used by this report has the AD security group I mentioned before, Reports-All,
    with Read.
    At a SharePoint level, things appear to work. When a user in ProjectManagers or ProjectUsers browses
    to the library, they see only the 3 reports that those two security groups have permission to see (out of a lot more in the library). That means SharePoint is reading those security group memberships correctly as far as I can tell.
    The issue is when a user in ProjectManagers or ProjectUsers clicks
    on a report, they get a reporting server based error message, and the ULS logs have an error specific to the user trying to run the report.
    Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'MyDomain\MyUser' are insufficient for performing this operation. (Fault Detail is equal to Microsoft.ReportingServices.ServiceContract.RsExceptionInfo)
    If I add that specific user with Read permissions to the report and the data source, they are then able to run the report without errors. It seems like some Report Server component is not liking the fact that I'm using security groups. 
    Has anyone seen this behavior with AD security groups? Any ideas on why my environment does not want to work properly with those even though AD security groups are working fine for other non-Reporting Services files?
    Thanks,
    Aaron

    Hi aaronzott,
    According to your description, you configured SSRS 2012 of SharePoint integrated mode. You added read permission to reports and data source to AD security group Reports-All, then added just read permission to ProjectManagers and ProjectUsers groups. When
    users in ProjectManagers or ProjectUsers groups click report, the error message occurred. After you added Read permissions to the report and the data source to the groups, they can preview the report without errors.
    Report definition permissions are defined through List permissions on the library that contains the report, but we can set permissions on individual reports if we want to restrict access. Set properties on a report including data source connection information,
    processing options, and parameter properties. Edit Items on the library that contains the report or on the individual report. We also need to have view permissions on a shared data source (.rsds) to select it for use with the report.
    For more information about Set Permissions for Report Server Operations in a SharePoint Web Application, please refer to the following document:
    http://msdn.microsoft.com/en-us/library/bb326286(v=sql.110).aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.

  • XSLT Grouping & Muenchian Method STRANGE PROBLEM

    Hi Everyone!
    I'm having a problem using a XMLTRANSFORM for grouping Muenchian Method.
    There are three oracle databases:
    DB1: Win2k3, Oracle 9.2.0.7 Standard,
    DB2: Win2k3, Oracle 9.2.0.7 Enterprise,
    DB3: WinXP, Oracle 10.2.0.1 XE.
    DB1 and DB2 are installed on different computers.
    And there are two scripts:
    S1: select
      xmltransform(xmltype(
      '<PROJECTS>
      <PROROW>
        <id>2</id><name>Customer 1</name><project_name>Project 2</project_name>
      </PROROW>
      <PROROW>
        <id>1</id><name>Customer 1</name><project_name>Project 1</project_name>
      </PROROW>
      <PROROW>
        <id>3</id><name>Customer 2</name><project_name>Project 1</project_name>
      </PROROW>
    </PROJECTS>'),
    xmltype(
    '<?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" encoding="UTF-8" version="1.0" indent="yes"></xsl:output>
    <xsl:key name="rows" match="PROROW" use="name" />
    <xsl:template match="PROJECTS">
    <xsl:element name="ROOT">
      <xsl:apply-templates
        select="PROROW[generate-id(.) = generate-id(key(''rows'', name)[1])]">
            <!--<xsl:value-of select="key(''rows'', name)">-->
      </xsl:apply-templates>
    </xsl:element>  
    </xsl:template>
    <xsl:template match="PROROW">
      <b><xsl:value-of select="name" /></b>
      <ul>
        <xsl:for-each select="key(''rows'', name)">
          <li>
            <xsl:element name="COUNT_KEYS">
              <xsl:value-of select="count(key(''rows'', name))" />
            </xsl:element>
            <a href="projects_results.xml?project={id}">
              <xsl:value-of select="project_name" />
            </a>
          </li>
        </xsl:for-each>
      </ul>
    </xsl:template>
    </xsl:stylesheet>')) x
    from dual;S2: select
      xmltransform(xmltype(
      '<REPORT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="report.xsd">
      <CONCEPT ID="0" TYPE="0">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">0</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.93a</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.94</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.44</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.93</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.94</COL>
        </ROW>
      </CONCEPT>
    </REPORT>'),
    xmltype(
    '<?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8" version="1.0" indent="yes"></xsl:output>
    <xsl:key name="rows" match="CONCEPT" use="concat(@ID, @TYPE)" />
    <xsl:template match="REPORT">
      <xsl:copy>
          <xsl:apply-templates select="@*"/> 
          <xsl:apply-templates
            select="CONCEPT[generate-id(.) = generate-id(key(''rows'', concat(@ID, @TYPE))[1])]"/>
      </xsl:copy>
    </xsl:template>
    <xsl:template match="CONCEPT">
      <xsl:copy>
          <xsl:apply-templates select="@*"/>
          <!--<xsl:value-of select="count(key(''rows'', concat(@ID, @TYPE)))"/>|-->
          <xsl:for-each select="key(''rows'', concat(@ID, @TYPE))">
                        <xsl:copy-of select="ROW"/>
          </xsl:for-each>
      </xsl:copy>    
    </xsl:template>
    <xsl:template match="@*">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:stylesheet>')) x
    from dual;S1 comes from http://sourceware.org/ml/xsl-list/2000-07/msg00458.html.
    S2 is mine.
    The results of executing these scripts are:
    S1 on DB1 & DB2:
    <ROOT>
      <b>Customer 1</b>
      <ul>
        <li>
          <COUNT_KEYS>1</COUNT_KEYS>
          <a href="projects_results.xml?project=2">Project 2</a>
        </li>
      </ul>
      <b>Customer 2</b>
      <ul>
        <li>
          <COUNT_KEYS>1</COUNT_KEYS>
          <a href="projects_results.xml?project=3">Project 1</a>
        </li>
      </ul>
    </ROOT>S2 on DB1 & DB2 is variable. For example:
    <REPORT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="report.xsd">
      <CONCEPT ID="0" TYPE="0">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">0</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.93</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.94</COL>
        </ROW>
      </CONCEPT>
    </REPORT>I obtained results with 2 (first two) and 5 (correct result!) <ROW> elements for <CONCEPT ID=”0” TYPE=”1”>.
    When I run S3 cyclic it returns (randomly): 2, 2, 2, 2, 5, 5, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 2, ,2, 2, 2,5, 5, 5, 5, 5, 2, 2, 2 ROWs for 2nd CONCEPT. Sounds impossible? 1st CONCEPT is always with 1 <ROW>.
    I noticed that, when I remove xsi:noNamespaceSchemaLocation="report.xsd" attribute or set it to the value of not registered schema, S2 always return one (the first from the top) ROW for both CONCEPTs.
    I don't think it is a problem of my report.xsd schema, but the content of this schema is:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:flags="291" oraxdb:schemaURL="report.xsd" oraxdb:schemaOwner="SYS" oraxdb:numProps="7">
      <xs:element name="REPORT" type="reportType" oraxdb:propNumber="2447" oraxdb:global="true" oraxdb:SQLName="REPORT" oraxdb:SQLType="reportType229_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258"/>
      <xs:complexType name="reportType" oraxdb:SQLType="reportType229_T" oraxdb:SQLSchema="SYS">
        <xs:sequence>
          <xs:element maxOccurs="unbounded" name="CONCEPT" oraxdb:propNumber="2453" oraxdb:global="false" oraxdb:SQLName="CONCEPT" oraxdb:SQLType="CONCEPT230_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="CONCEPT236_COLL" oraxdb:SQLCollSchema="SYS">
            <xs:complexType oraxdb:SQLType="CONCEPT230_T" oraxdb:SQLSchema="SYS">
              <xs:sequence>
                <xs:element maxOccurs="unbounded" name="ROW" oraxdb:propNumber="2452" oraxdb:global="false" oraxdb:SQLName="ROW234" oraxdb:SQLType="ROW231_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="ROW234235_COLL" oraxdb:SQLCollSchema="SYS">
                  <xs:complexType oraxdb:SQLType="ROW231_T" oraxdb:SQLSchema="SYS">
                    <xs:sequence>
                      <xs:element maxOccurs="unbounded" name="COL" oraxdb:propNumber="2451" oraxdb:global="false" oraxdb:SQLName="COL" oraxdb:SQLType="COL232_T" oraxdb:SQLSchema="SYS" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="COL233_COLL" oraxdb:SQLCollSchema="SYS">
                        <xs:complexType oraxdb:SQLType="COL232_T" oraxdb:SQLSchema="SYS">
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="NAME" type="xs:string" use="required" oraxdb:propNumber="2450" oraxdb:global="false" oraxdb:SQLName="NAME" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1"/>
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="ID" type="xs:short" use="required" oraxdb:propNumber="2448" oraxdb:global="false" oraxdb:SQLName="ID" oraxdb:SQLType="NUMBER" oraxdb:memType="3" oraxdb:memByteLength="2"/>
              <xs:attribute name="TYPE" type="xs:short" use="required" oraxdb:propNumber="2449" oraxdb:global="false" oraxdb:SQLName="TYPE" oraxdb:SQLType="NUMBER" oraxdb:memType="3" oraxdb:memByteLength="2"/>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>S1 on DB3:
    <ROOT>
      <b>Customer 1</b>
      <ul>
        <li>
          <COUNT_KEYS>2</COUNT_KEYS>
          <a href="projects_results.xml?project=2">Project 2</a>
        </li>
        <li>
          <COUNT_KEYS>2</COUNT_KEYS>
          <a href="projects_results.xml?project=1">Project 1</a>
        </li>
      </ul>
      <b>Customer 2</b>
      <ul>
        <li>
          <COUNT_KEYS>1</COUNT_KEYS>
          <a href="projects_results.xml?project=3">Project 1</a>
        </li>
      </ul>
    </ROOT>S2 on DB3
    <REPORT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="report.xsd">
      <CONCEPT ID="0" TYPE="0">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">0</COL>
        </ROW>
      </CONCEPT>
      <CONCEPT ID="0" TYPE="1">
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.93a</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">9.94</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.44</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.93</COL>
        </ROW>
        <ROW>
          <COL NAME="REG_ID">0</COL>
          <COL NAME="UNIT_ID">0</COL>
          <COL NAME="UNIT">RAPORT ZBIORCZY</COL>
          <COL NAME="LP_OPIS">10.94</COL>
        </ROW>
      </CONCEPT>
    </REPORT>DB3 always generates good results for both scripts. <CONCEPT ID=”0” TYPE=”1”> always consists of 5 ROWs regardless of the attribute xsi:noNamespaceSchemaLocation value (schema registered or not). It is my computer at home. I decided to install oracle there because of the problems with DB1 and DB2. Unfortunately these are my DBs at work. So I need to run XMLTRANSFORM there.
    IMHO problems of S2 derive from result of S1 - function count(key(''rows'', name))
    always returns 1 regardless of number of rows. But this is only my supposition.
    I don’t know what is going on. The results of S3 on DB1/2 make me sick.
    I tried client 9.2.0.8, instant client 11.1.0.6.0 and no client – a job (transformation was inserted to a table) and this problem still exists.
    Any suggestions?
    Thanks in advice…
    Tomek.

    Hi,
    maybe you are right (I think similar), but I can't find any information about this bug on the Internet. So this is strange, if it is really a bug. I hope somebody used (or tried to use) this Muenchian Method in oracle 9.2.x, and can tell does it works or not.
    In [Oracle9i XML Developers Kits|www.oracle.com/technology/tech/xml/xdk_sample/9ir2_xdkfaq.html] there is written:
    "You can do the grouping in your XSLT stylesheet Steve Muench's Book "Building Oracle XML Applications" book dedicates a section in Chapter 9 to techniques for doing this kind of grouping in XSLT to present one- or multi-level break reports...
    The technique that I present in steve's book was coined the (blush...) "Muenchian Method" for doing grouping in XSLT."
    Thanks,
    Tomek.
    Edited by: tdomanek on 2009-03-15 17:14
    Edited by: tdomanek on 2009-03-15 23:48

  • 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

  • XSLT Grouping & Sorting in 10g BPEL

    Hi,
    Can any one tell how we can achieve grouping and sorting of xslt in soa 10g.
    This is possible in 11g but not getting any clue as how to proceed for 10g.
    Please response soon.
    Thanks & Regards,
    Divya

    this one works for me
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ns1="http://xmlns.oracle.com/SampleJDE_BioprodProcess">
         <xsl:template match="/">
              <ns1:SampleJDE_BioprodProcessProcessResponse>
                   <xsl:for-each select="/ns1:SampleJDE_BioprodProcessProcessResponse/ns1:billToNumber">
                        <xsl:sort select="."/>
                        <test>
                             <xsl:value-of select="."/>
                        </test>
                   </xsl:for-each>
              </ns1:SampleJDE_BioprodProcessProcessResponse>
         </xsl:template>
    </xsl:stylesheet>output
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:SampleJDE_BioprodProcessProcessResponse xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ns1="http://xmlns.oracle.com/SampleJDE_BioprodProcess">
         <test>1</test>
         <test>2</test>
         <test>9</test>
    </ns1:SampleJDE_BioprodProcessProcessResponse>

  • Multi Level Grouping Issue in SharePoint 2010

    Hi All
    I want to acheive multilevel grouping in my SharePoint Views.I need to acheive grouping up to 5-6 levels of columns.
    Is there any way we can acheive this?
    Any Pointers to Custom Solutions,Custom Controls in .NET can be utilised in SharePoint to acheive this?
    Please provide some pointers
    Regards
    Mahesh

    Hello,
    previously asked questions contain a link to:
    http://techtrainingnotes.blogspot.in/2011/01/sharepoint-group-by-on-more-than-2.html
    The article basically describes how to create and use a DVWP instead of a XSLT List View. The out of the box SharePoint list view cannot have more than two groups. You need to either edit the View page and add a DVWP or create a new page with a DVWP.
    SP 2010 view pages lose some functionality if web parts are added (showing ribbon is not as straightforward and view selector disappears), but there are workarounds.
    In some cases, a Web Part Page with a DVWP may be a better alternative.
    cheers, teylyn

  • Grouping Issue - Siebel related

    Hi All,
    Am facing an issue in one of the reports. Below is the scenario.
    I need to group my Contact list report on "Country" field which is not a direct field in Contacts. It is coming from another Business Component in Siebel which is "Personal Address".
    This is not working. But when I try to group the report based on a field which is a direct field from Contacts, it is working fine. (Ex: Contact Name)
    Am unable to achieve this. Kindly help me with this.
    Thanks in advance,
    Imtiaz.

    Since your country details are under contacts, use the correct path for regrouping.

Maybe you are looking for