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 ;(((((((

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
             || '<SPAN style="font-weight:bold;color:green">'
             || c.ename
             || '</SPAN>'
             || ', </br></br>';
       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 - 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

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

  • 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

  • How to use document() function in PL/SQL XSLT parser ?

    The "XDB Developers Guide" documentation says on page 12-18
    >
    The application can use DBUriType objects:
    To make references, such as import or include, to related XSL stylesheets. You can encode these references within the XSL stylesheet itself.
    following this i added string like this to my stylesheet
    <xsl:apply-templates select="document('/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()')" mode="include"/>
    <xsl:cinclude href="/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()"/>
    But when XSLT processor reaches this, it fails.
    I also even tried like this
    <xsl:include href="/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()"/>
    but result is the same ;(((
    Generally - is there ANY way XSLT processor can deal with stylesheet which contains
    DBURI references to another stylesheets stored in XMLTYPE columns ?
    I'm currently in charge to develop a content management system for a huge corporate site,
    so i'm VERY interested to know - does this feature really exists on Oracle 9.2 ?
    Please ansver ASAP.

    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

    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

  • Secondary XML source via document() function

    Has anyone used the XSLT document function in an XSL-FO template where the file is an URL. We are trying to do this to get extra information for the PO output in an EBS installation without horrible customisations
    eg
    <xsl:text>Person : <xsl:value-of select="document('http://dbsdev11.uk.baa.com:8031/OA_HTML/test.xml')/xxpo:PO_DATA/xxpo:PERSON_ID"/></xsl:text>
    where test.xml is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xxpo:PO_DATA xmlns:xxpo="http://uk.baa.com/oracle/apps/po/info">
    <xxpo:PERSON_ID>120</xxpo:PERSON_ID>
    <xxpo:SERVER_PORT>8031</xxpo:SERVER_PORT>
    </xxpo:PO_DATA>
    and the URL http://dbsdev11.uk.baa.com:8031/OA_HTML/test.xml resolves quite happily when pasted into a browser.
    But nothing comes back when previewing the template in EBS. PDF is produced but Person value is not populated.
    Is the document function supported??
    Rgds
    James M

    Hi Jame
    Document() is supported but what you are trying to do with it is not, i.e.
    document('http://dbsdev11.uk.baa.com:8031/OA_HTML/test.xml')/xxpo:PO_DATA/xxpo:PERSON_ID"/
    will not work. You need to load the doc to a variable and then reference the PERSON_ID element.
    Something like:
    Variable Declaration
    ==================
    <xsl:variable name="news" select="document('http://rss.news.yahoo.com/rss/topstories')"/>
    Value
    ========================
    <?$news/rss/channel/title?>
    regards
    Tim

  • How to use xsl document() function with LiveCycle XSLT processor

    Hello,
    I would like to use LiveCycle XSLT processor to merge xml documents by using the xsl document() function.
    However, I have not, yet, found  clear reference information on the specifics of how to accomplish in LC. For instance if you have
    a transformation that does merging using a standalone xml editor (such as Oxygen), than what is required to accomplish the same
    using the LiveCycle XSLT service.  How do you specify the URI of the XML document that is specified as an input in the xsl document() function. Your insight is appreciated.   Regards

    Hello Steve,
    I checked the reference that you cited (XSLT Transformation).   The reference omits discussing how to use xlst document() function within a stylesheet.  I think that probably means that feature of xslt technology is not directly available through LiveCycle.  When I find a workaround, I'll post an update...for the user community that might encounter the same issue.  Thank you for your response and insight.  Regards, jb1809

  • Use document() function in xslt

    Hi I want to use the xslt function document() to import a data file into the transformation.
    However I don't seem to be able to import the xml file onto the osb. can this be done ?
    Basically can you use the document() function?
    I've tried googling and searching the docs but i think i'm missing something basic :-)
    Thanks in advance

    Not an answer to the particular point but i've got round the issue by adding a stage which inserts the data xml into the xml document being transformed.
    I then supress the data injected from being copied to the output tree and use a variable which references the data nodes rather than a variable referencing
    an external doc variable name="myvar" select="//injecteddatanode" /> rather than <variable name="myvar" select="document("path/doc.xml")
    The question still stands though : how do you import an xml doc which can then be used by the document function in a transform

  • Resolving url after document() function has been called by the xslt

    I am having problems resolving a URI when document() function in my xslt is called. The xml document that is being called has a reference to a dtd that is in another location of the webserver. When document() is called it downloads the xml document then tries to download the referenced dtd from the same location. I get an error kinda like this.
    file:///C:/dev.xsl; Line 15; Column 62; Can not load requested doc: File "http://dev.server.com/templatedata/lhj/story/data/dcr4.5.dtd" not found.
    The DTD is in a different location on the server and that is why it can not find it. I have tried resolving the URL but have been unsucessfull. See my java solution that does not work. How can I fix this? Any assistance will be greatly appreciated
    Java solution
    try {
    TransformerFactory tFactory = TransformerFactory.newInstance();
    tFactory.setURIResolver(new XMLURIResolver());
    Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
    File f = new File(xmlFile);
    FileReader fr = new FileReader(f);
    InputSource inputSource = new InputSource(fr);
    transformer.transform(new SAXSource(inputSource),
    new StreamResult(new FileOutputStream(outPutPath)));
    Vince.

    here is the resolver. The if in never excuted.
    public class XMLURIResolver implements URIResolver{
    public static final String DTD_HREF = "dcr4.5.dtd";
    public Source resolve(String s, String s1) throws TransformerException{
    System.out.println("s = "+ s);
    System.out.println("s1 = " + s1);
    InputStreamReader isr = null;
    try{
    if (s.indexOf(DTD_HREF) != -1){
    System.out.println("Fetching DTD....");
    URL url = new URL("http://mydomain/xml/validation/dcr4.5.dtd");
    isr= new InputStreamReader(url.openStream());
    return new SAXSource(new InputSource(isr));
    }catch(MalformedURLException mue){
    System.out.println(mue);
    }catch(IOException ioe){
    System.out.println(ioe);
    return null;
    }

  • Using xsl document function in transform xsl

    I'm trying to use an external xml document in an xsl transform that's used in a Transform activity in an 11g BPEL process:
    <xsl:variable name="plants" select="document('plantTransposeLookup.xml')/plants"/>
    I need to load up the document to use it in a lookup to get replacement values for a key.
    This works fine in JDev, but not when I deploy it to the server.
    The error I get when I run it is:
    The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: XML-22021: (Error) Error parsing external document: 'no protocol: plantTransposeLookup.xml'.. Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    I've also gotten:
    The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: XML-22021: (Error) Error parsing external document: 'Unsupported feature: 'document(''), when stylesheet built using InputStream, Reader'.
    I've also tried using the ora:doc function:
    <xsl:variable name="plants" select="ora:doc('plantTransposeLookup.xml', 'plants')"/>
    ......but this doesn't work in JDev and is also erroring off on the server with:
    The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: XML-22016: (Error) Extension function namespace should start with 'http://www.oracle.com/XSL/Transform/java/'.. Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    Does anyone know how to actually import an xml doc into a mapper??? I must be doing something stupid.
    Thanks for any help.

    In OSB, document() function needs absolute path of the XML file. So if you want to access the XML document for lookup, you need to put the XML file on the server itself and use the path of the XML file.
    Although this is not a correct approach for managing lookups in OSB. The resource of XML Document type are not to be used for such use cases. What you can do is create a XQuery which can server as DVM.
    Here is an example on how to use DVMs in OSB:
    https://blogs.oracle.com/christomkins/entry/domain_value_maps_in_oracle_se
    If you dont want to use XQuery and want to rely only on XSLT, then within the same XSLT document create a separate template which can store all the lookup data.

  • Document() function problem in Cocoon

    Hi,
    I have a problem using document() function in xslt. Transformation is done via Cocoon. I know that document() function is problematic in Cocoon, but I think still it is possible to use document() in Cocoon or?
    Here is the simple code:I am getting Java NullPointerException.
    <xsl:variable name="myfile"
    select="document('file:///c:/Temp/temp.xml')" />
    <xsl:value-of select="$myfile/document/doc/@id" />
    If document() function is not possible in Cocoon, can anyone suggest me another way?
    thanks

    Are you sure that you can access a local file?

  • How to write procedure or function or any sql statement for requirement

    Hi,
    i have a table named letter,it contains 2 columns named as letter_id and letter_content.
    select * from letter;
    letter_id letter_content
    103 Dear MFR
    103 This is in regards to the attached DM List
    103 Please Credit us after reviewing it.
    103 Thanks
    103 Regards
    103 xxxx
    108 Dear customer
    108 This is to inform that ur DM List is as follows
    108 Credit us according to the Dm after reviewing it.
    108 Thanks
    108 Regards
    108 xxxx
    now my requirement is,i need send a parameter as letter_id to a procedure or function in pl/sql in oracle,the output should be as follows:
    if we will pass parameter(letter_id) = 103 then it displays as follows:
    Dear MFR
    This is in regards to the attached DM List.Please Credit us after reviewing it.
    Thanks
    Regards,
    XXXXX.
    if we will pass parameter(letter_id) = 108 then it should displays as follows:
    Dear customer,
    This is to inform that ur DM List is as follows. Credit us according to the Dm after reviewing it.
    Thanks
    Regards,
    XXXXX.
    ---------------------------------------------------------------------------------------------------------

    i am really appriciate ur help.
    thank u so much for ur suggestions.
    when i am uning line_seq its giving an error
    ORA-00904: "LINE_SEQ": invalid identifier
    so,in my table i had created a sequense named content_seq.
    select * from letter;
    content_seq letter_id letter_content
    1 103 Dear MFR
    2 103 This is in regards to the attached DM List
    3 103 Please Credit us after reviewing it.
    4 103 Thanks
    5 103 Regards
    6 103 xxxx
    7 108 Dear customer
    8 108 This is to inform that ur DM List is as follows
    9 108 Credit us according to the Dm after reviewing it.
    10 108 Thanks
    11 108 Regards
    12 108 xxxx
    then i had used ur code as follows:
    select linefrom ( select content_seq , letter_content || case content_seq when 2 then ' ' || lead(letter_content) over (partition by letter_id order by content_seq) end as line from letter where letter_id = 103 )where content_seq <> 3;
    LETTER_CONTENT
    Dear MFR
    this is in regards to the attached DM List Please credit us after reviewing it
    thanks
    Regards
    EXP
    but when i take letter_id = 108 the format is comming different.it was unable to combine 2lines.
    Message was edited by:
    user579585
    Message was edited by:
    user579585

Maybe you are looking for

  • How to make On Account Payment

    Hi all, How to make On Account Payment. What is the difference between On Account Payment and Down Payment Thanks

  • AVG problem with sqlite tracking cookies

    Every time I open Firefox I get an AVG warning about tracking cookies in Sqlite. I can't clean these cookies. AVG deny that there is a problem with AVG, so how can I fix this? I'm fed up of it and on the verge of going back to IE just so that I can o

  • SAP NW PI license issue

    Hello, I installed PI70 some time back and ordered SAP for license key. But, due to issues i have to re-install it later. What happened here is the hardware key is changed after the installation. Is it means i have request again SAP to get license ke

  • Since 10.7 DVD Player has sound but no video

    MBP with 10.7 is not showing video I get a black screen, although there is sound. DVD in question worked prior to upgrade.

  • How to monitor hardware for Sun SPARC T2000

    Which add-on do I have to install on my Sun Management Center 4.0 server to be able to monitor the hardware of a Sun SPARC T2000 agent?