XSLT uniqueness function

I have a large number of elements with equal-valued attributes, e.g. <Item page="1">. Is there a way within XSL to discover the unique values of @page?, e.g. 1,2,3 ignoring duplicates?

Thanks, excellent: see here. There is also the Xalan 'set' extension that provides a set:distinct() function, although as at Xalan 2.7.1 it is still broken if the inputs are attributes rather than nodes.

Similar Messages

  • Looking for example - abap xslt - that uses xslt document() function

    Hello,
    I'm looking for an example that shows the use of abap xslt with the xslt document() function.  Using the xslt document() function seems like a straightforward way to use xslt to create a result xml document by processing the content of two or more
    source documents.  For example, if source document A.xml and aux.xml are available in  memory as xstringand using stylesheet ztransformwhat would be the argument for the document() function to associate aux.xml.  Thanks for any insight.
    Regards,
    jb10809

    Hi,
    Sorry, perhaps I should have been clearer! The function that I picked just to test what you need to do just happened to return a string that contains SPAN tags with style attributes. The actual function code is:
    create or replace FUNCTION out_string_fn
       RETURN VARCHAR2
    IS
       CURSOR emp_cur
       IS
          SELECT ename
            FROM emp;
       v_string   VARCHAR2 (4000);
    BEGIN
       v_string := ' ';
       FOR c IN emp_cur
       LOOP
          v_string :=
                v_string
             || '&lt;SPAN style="font-weight:bold;color:green"&gt;'
             || c.ename
             || '&lt;/SPAN&gt;'
             || ', &lt;/br&gt;&lt;/br&gt;';
       END LOOP;
       RETURN v_string;
    END;And this returned a naff list in green (see [http://apex.oracle.com/pls/otn/f?p=55041:57] and click the Test button) - but it does show that you can style the validation error messages
    Andy

  • XSLT document() function in PL/SQL XDK

    I'm using the PL/SQL XDK (9.2.0.2.0) to do XSLT transformations but having
    no success using the XSLT document() function.
    I just get the error
    ORA-20100: Error occurred while processing: XSL-1021: (Error) Error parsing
    external document: 'wrongmachine.mycompany.com'.
    Can the document function access an external xml file using http from pl/sql?
    eg. http://amachine.mycompany.com/xmldocs/myxml.xml
    I've tried setting the ref parameter of the newStylesheet function, assuming
    this sets up the base uri for the stylesheet
    xslss := xslProcessor.newStylesheet
    (xmldoc => xsl_doc,
    ref => 'http://amachine.mycompany.com/xmldocs');
    I've also used the setBaseDir on both the DOMDocument and the stylesheet
    xmlparser.setBaseDir(p => xsl_parser,
    dir => 'http://amachine.mycompany.com/xmldocs');
    I've tested the XSL stylesheet in Saxon and it works fine.
    Other XSL transformations also work fine using the Oracle XDK but none that use
    document()
    'wrongmachine.mycompany.com' is not even the machine the code is executing on!?
    Is this set up in an installation script?
    Any ideas/examples on how document() can be used in the pl/sql XDK?
    Thanks
    John Holder

    BTW: following this link
    xsl:include within XSL stylesheet stored in XMLType column
    i've encountered that this theme has been asked but none from Oracle staff has answered on it yet ;(((((((

  • XSLT document function - bug?

    I have an XSLT stylesheet which loads several XML documents, by using the XSLT document() function.
    The XSLT document() function works fine using Saxon processor and Firefox. Also it works fine in Safari 3 when the XSLT stylesheet is processed as a stylesheet referenced from an XML-file.
    But, when processing the XSLT stylesheet from Javascript, in Safari 3, using xsltProcessor.transformToDocument() the document() function does not load the files. It can be added, that I am running everything from the local harddrive.
    Anyone has similar experience or some workaround?
    There is a similar post http://discussions.apple.com/thread.jspa?threadID=1559485&tstart=1 about Safari-Windows, but no resolution to the problem.
    Message was edited by: Tomas Jonsson
    Message was edited by: Tomas Jonsson

    I have now made an example to demonstrate this bug. Firefox 3 will do the right thing, Safari 3 and 4 both have the same problem.
    http://www.tomasjonsson.eu/docbugtest/docbugtest.html

  • ESB XSLT Extension Functions

    Hi
    Could anybody tell me if we can use log4j in the java class which we write for XSLT Extension Functions which will be used in ESB XSL mappings?
    It is not recognizing log4j only.It is not giving any error also.
    Thanks
    Praveena

    Thanks Kanchan.
    This is talking about how to implement Extension functions.
    I have done this. but my question I am not able to use log4j for debugging purpose in this java class. It is not recognising this.
    We need to use logger instead of System.out.println .
    Thanks
    Praveena

  • Unique function based index

    Hello forum,
    Is it possible to define an unique function based index in OWB?
    Like:
    create unique index uk1 on my_table (case very_busy when 'Y' then 'Y' else null end);
    Thank you!

    Hi
    It doesn't look like it, in the OMB doc the INDEX_TYPE has values: UNIQUE, NON-UNIQUE, BITMAP, FUNCTION-BASED so as-is unique and function-based can't be combined.
    Cheers
    David

  • XSLT document() function not working properly

    I have this XSLT:
    <xsl:copy-of select="document($file1)/employee/address/*"/>
    I have this java which is setting the parameter for $file1
    transformer.setParameter("file1",file.getAbsolutePath());I printed out the value of $file1 in the XSLT style sheet using:
    <xsl:message><xsl:value-of select="$file1"/></xsl:message>
    The Path it prints out is the correct path, let say its c:\myfile\file1.xml
    When it reaches the doument($file1) function, it seems that the path is getting changed.
    To give you an example, if $file1 = "c:\myfile\file1.xml" and my XSLT file is located at c:\xsl\myXSl.xsl then the path that document() gets is:
    c:\C:\xsl\myfile\file1.xml
    This causes the following error to occur:
    (The filename, directory name, or volume label syntax is incorrect)
    Why is document() inserting the path where the XSL file which it is in into the path of the file I'm trying to open? I am using the Xalan API to transform this XML.
    Have anyone seen anything like this before?
    Thanks
    Al

    When I looked up some Internet pages that described the document() function, they all said it required a URI as its parameter. A Windows file path is not a URI. However it's possible to get a URI from a File object, so you might want to try that.

  • XSLT document() function

    I am using the Oracle XML parser, and I am finding that some funny things are happening when I try to use the document(object, node-set?) function, as defined in the XSLT specification. For some reason, my xmlns path is being prepended to any file path I use in the "object" argument, so I can't access any local files:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"/>
    <xsl:value-of select="document('local_file')"/>
    ... results in the following error message:
    oracle.xml.parser.v2.XSLException: XSL-1021: Error parsing external document: 'http://www.w3.org/XSL/Transform/local_file';
    Furthermore, if I try to use the "node-set" (2nd) argument, I get invalid expression errors.
    Any suggestions?
    Thanx, Kat.

    Hi,
    There could be a problem with the way the XSLStylesheet is being created. If you are using the command line version, it could be a
    problem in the parser. If you are using programmatic construction of the XSLStylesheet, be careful that that the second argument 'URL ref' is used to get absolute paths from relative paths. Check what you are setting this second arg
    to. Let us know if you experience additional problems.
    Thanks,
    Oracle XML Team
    null

  • XSLT-Processor functions/variables

    Hello
    I have a problem with variables in a xslt-sheet. Are there any restrictions
    in the oracle.xml.parser.v2 about variables and functions?
    Thanks for your help
    best
    chrue.

    No restrictions beyond those required by the specification.
    Would surely help to see a simple example of the problem you're running into.

  • Use DOM as an argument of  XSLT document() function

    I have in memory several DOM documents. I have not stored in file system the XML files that are represented by these DOMs. I want to process with a stylesheet
    all of these DOMs (as DOMSource's) using document() function from the stylesheet. How can I refer to the secondary DOMs from document function if I haven't the files?
    F.e.
    <xsl:value-of select="document('file.xml')/.../..."/> file.xml only exists loaded in memory as DOM.
    Can anybody help me?? Thanks

    Thank you DrClap but I'm not sure about the use of URIResolver:
    if my xslt:
    <xsl:value-of select="document('file1.xml')\...\..."/>
    <xsl:value-of select="document('file2.xml')\...\..."/>
    I must define my own class that implements URIResolver and write my own resolve method, isn't it?
    class Resuelve implements URIResolver{
         private Document doc1;
         private Document doc2;
         public Resuelve(Document doc1, Document doc2){
              this.doc1 = doc1;
              this.doc2 = doc2;
         public Source resolve(String href, String base){
              if(base.equalsIgnoreCase("file1.xml")){
                   Source s1 = new DOMSource(doc1);
                   return s1;
              else if(base.equalsIgnoreCase("file2.xml")){
                   Source s2 = new DOMSource(doc2);
                   return s2;
              else{
                   return null;
    I suppose that XSLT processor use automatically resolve method. I don't understand the href parameter...
    Is this class correct? if not, can you show me an example please?
    Thank you very much

  • XSLT TRIM Function

    Hi,
    We are into XSLT mapping, we had a requirement like below;
    Note:
    Transformation Between A to B:
    if value(A) NOT NULL then left(right(rtrim(VALUE),3),2) -
    > B
    How can we develop the similar function in XSLT?!!
    Thanks n Advance.,
    Stallin

    Hi Abhishek,
    mail id: [email protected]
    And I'll give the example input also for the functionality.
    INPUT: APPLE ---> After Transformation --> Output: PL
    Condition: if value(A) NOT NULL then left(right(rtrim(VALUE),3),2) ;
    Do the needful...
    -Stallin

  • XSLT extension function probelm

    Hi, I have some problems when I tried to migrate from Xalan to Oracle XSLT engine.
    I have to traverse a huge XML document, the usual XPath is rather slow so we developed a Java class that kept a reference to some of the important Nodes.
    The XSL looks like
    <xsl:variable name="password">
    <xsl:value-of select="customJavaClass:customFunctionReturningNode()/password/@value"/>
    </xsl:variable>
    After the call to the static function stays a valid XPath. That worked fine with Xalan but with Oracle I get something like "unexpected EOF".
    Any ideas?
    null

    The whole application is based on heavy usage of XSL. Tens of transformations are done just for one user. We are trying to optimize as much as possible the memory usage and the speed. Using top-level stylesheet variables is too much memoty consumption (we tried it).
    I don't think the code returning the Node Object is of importance. It is not even called (I inserted debug statements). I guess the problem is while the Oracle XSL processor is analyzing the XSL.
    I'll try these keys that you are suggesting. Is there any URL I can retrieve additional information and performance analysis for these keys?

  • Extend XSLT sort function

    Is there a way to extend the sort function provided by XSLT? I am using XALAN. Basically, the elements that I need to sort need a more specific sort than just text or number.
    thanks

    well the default sorts are on number or text. But say I want to sort on network addresses, such as 1.2.3.4 ....text and number dont work here, I need my own sorting (like i would do with a Comparator)..
    so if i had
    1.2.3.4
    170.1.3.3
    2.4.3.2
    I would want the sort to be like
    1.2.3.4
    2.4.3.2
    170.1.3.3
    ...however (number wont work) and text sort does
    1.2.3.4
    170.1.3.3
    2.4.3.2
    see what i mean?

  • Need milli seconds part in XSLT Date Function  current-dateTime()

    Hi All,
    I am calling date function, current-dateTime() in XSL. The output format is 2012-04-05T16:38:01-07:00 (Without milli seconds)
    How to get the milli seconds part...?
    Regards,
    Sudheer

    Hi Arik....
    At last i got it. :)
    Followed the below steps.
    Step1:
    Created a String variable "currentDateTimeValue" in BPEL.
    Step2:
    I have used the below code in JavaEmbedding in BPEL.
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat();
    //Date Pattern looks lil weird. But some Web service accepts only this format.
    sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'-00:00'");//2012-04-14T16:24:00.578-00:00
    String formattedDate = sdf.format(new java.util.Date());
    addAuditTrailEntry("Formatted datetime string is: " + formattedDate);
    setVariableData("currentDateTimeValue", formattedDate);
    Step3:
    Created a Simple XSD with an element "DateElement" of String type.
    Step4:
    Assigned "currentDateTimeValue" value to "DateElement" element, in Assign activity.
    Step5:
    Now added this DateElement in Transformation activity, as a second source variable. Mapped this data to the required target element in my XSL.
    uh-huh I got the output...
    Thanks a ton ARIK :D u r really helpful...
    Regards,
    Sudheer

  • XSLT document function issue

    I have XSL transformation using document() function to combine xml docs, using Oracle 10.2.0.2.
    <xsl:for-each select="document('/export/home/myunixdirectory/Products.xml')/PRODUCTS">
    When I run DBMS_XSLPROCESSOR.processXSL(proc, ss, document_in); I get error
    ==============
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    ==============
    Products.xml is valid, tried it with no unix directory specified, etc., no luck. Also have commented out section related to document function and code works, so it is related to this document processing in the Oracle XSL processor. The transformation works in XMLSPY (pointing to files on local drive).
    Any ideas on how to get this to work?

    Here's more info in case anyone wants take a crack at guessing what's wrong. I've tried a bunch of different methods for document() function, at this point I am nearly convinced it is not supported by the Oracle XSL processor.
    Products.xml...
    <?xml version="1.0" encoding="UTF-8"?>
    <PRODUCTS>
         <PRODUCT>
              <BRAND_CODE>11111</BRAND_CODE>
              <BRAND_NAME>SOMETHING HERE</BRAND_NAME>
              <GRADE>P</GRADE>
         </PRODUCT>
    </PRODUCTS>
    XSL file (simplified)…in same directory as Products.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
         <xsl:variable name="geterrorwhenrun" select="document('Products.xml')"/>
         <xsl:template match="/REGION">
              <REGION>
                   <xsl:attribute name="xsi:noNamespaceSchemaLocation">any.xsd</xsl:attribute>
              </REGION>
         </xsl:template>
    </xsl:stylesheet>
    Error I get...
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    PL/SQL Code...
    -- parse xsl file
    DBMS_XMLPARSER.parse(p, xslfile);
    -- get document
    xsldoc := DBMS_XMLPARSER.getDocument(p);
    -- make stylesheet
    ss := DBMS_XSLPROCESSOR.newStylesheet(xsldoc, xslfile);
    proc := DBMS_XSLPROCESSOR.newProcessor;
    DBMS_XSLPROCESSOR.showWarnings(proc, true);
    docfrag := DBMS_XSLPROCESSOR.processXSL(proc, ss, document_in);
    -- GET ERROR on line above, however if I comment out the geterrorwhenrun variable line, transform works

Maybe you are looking for

  • Can items be published as portlets in release 2 ?

    Does anyone know if it is possible to publish a text item as a portlet in release 2. Feedback appreciated Anders

  • BP (is Vendor and also Customer) reconciliation

    Hi Experts, I am an user of SAP B1. I tried the internal reconciliation for BP who is both Customer and Vendor. The function is working. But the multicurrency has problem. Here is the detail of my testing: trade in USD, local currency is CAD, System

  • Tax Calculation

    I am having an issue with Tax amount calculations. If the 'TxN' Indicator is checked in the Tax jurisdiction config - which means the Discount amount be deducted from the Invoice amount to determine the Tax base amount for calculation of Tax amount.

  • Help with z program output and scrollbars

    Morning all We are running an ERP2004 SAP system, and we're having some problems with a z program. Basically it was a quick bit of code put together to check user names against the names stored in PA. Now the problem is that when the report is output

  • Mailbox Server Role Services not running: MSExchangeDelivery

    Running Exchange 2013 CU7 on Server 2012R2. Ive been working on this project on and off for the last few months, as I am the only IT guy, and a new office construction at my company has had me running cable, moving offices, workstations, and phones.