Result- resource transformation

Hi,
I've got 2 transformation, where in first I create output xsl-
transformer= factory.newTransformer("pattern.xsl");
StreamResult result=new StreamResult(new File("another.xsl"));
transformer.transform(new StreamSource("source.xml"), result);
and then I need use result as resource to second transformation.
How can I do it?
thank you

Yes, that works. Just a comment: a ByteArrayOutputStream will produce a byte array rather than a String in memory. Takes half as much space as the String, doesn't require the encoding from byte to String, and avoids possible errors with bad choices of encoding.

Similar Messages

  • Web Repository: Result Resource Filter not filtering

    I have an issue with the result of my Result Resource Filter. Maybe somebody can point me to my mistake ?
    In site B i have several languages that i don't want to show, since they are the same, but the URL is different.
    I am ending up with the same site appearing several times, where it should only appear twice (English and German)
    I have a site A, which also posseses the /index.php.
    The language parameter can appear twice when a language switch is done, but the last language parameter will be used.
    http://www.siteB.com/index.php?id=10&L=10&L=7
    http://www.siteB.com/index.php?id=10&L=11&L=7
    http://www.siteB.com/index.php?id=10&L=7
    http://www.siteB.com/index.php?id=10&L=8&L=7
    The only languages should be 7 and 0
    The result resource filter settings are :
    - Include Documents/ web-Pages : true
    - Item ID Mode : exclude
    - Item ID Pattern: siteB.com/index.php&L=8,siteB.com/index.php&L=9,siteB.com/index.php&L=10,  siteB.com/index.php&L=11
    I tried before just using "/index...." , but that did not work either. And i want to be sure that correct URL is filtered....
    With this setup i would excect, that only this pages appear:
    http://www.siteB.com/index.php?id=10&L=7
    http://www.siteB.com/index.php?id=10&L=0
    but they appear all.....
    Regards,
    Kai

    Hi Kai.
    Assuming your correct links may look like
    http://www.siteB.com/index.php?id=10&L=7
    http://www.siteB.com/index.php?id=7&L=0
    http://www.siteB.com/index.php?id=295&L=7
    try this expression:
    http://www\.siteB\.com/index\.php\?id=\d+\&L\=[07]
    Hope it helps.
    Best regards,
    Aliaksandr Zhukau

  • Use query results in transformation

    Hello experts,
    is it possible to use the results of a query to load data to a infocube?
    We have an infocube containing detailed data. On this cube a query is built with a lot of calculated key figures. Now we would like to load these calculated key figures to a more aggregated cube.
    Thanks in advance,
    Ralph
    points will be awarded

    I would look at the APD process that Edwin mentions.  Typically, the way it would work is you use your query as input, writing the results to a DSO, then datamart the results form there to the cube.
    APD could also be used to directly update a Mstr Data infoobject if that made more sense, then datamart that to he cube.
    I'm not familiar with the CRM / falt file approach mentioned.  Might be fine for what you want to do.  The APD process has more options to perform additional manipulation of the data and even joining it with other query results if you wanted, plus the results end up in a DSO that I think might provide more options for retaining and managing the query results.
    You can review the online help for APD, also SAP's Data Mining class BW380 (might have a new name for BI 7.0) covers this area.

  • Mysql_num_rows(): supplied argument is not a valid MySQL result resource

    function validatelogin($username, $password)
    $query = $this->escape("SELECT * FROM 'ampmember' WHERE
    'username'='%s' AND 'password'='%s'", $username, $password);
    NetDebug::trace($query);
    $rs = mysql_query($query);
    if(mysql_num_rows($rs) == 1) (THE ERROR IS WITH THIS ROW)
    return true;
    else
    return false;
    * Escape a SQL String
    * @access remote
    function escape($sql)
    $args = func_get_args();
    foreach($args as $key => $val)
    $args[$key] = mysql_real_escape_string($val);
    $args[0] = $sql;
    return call_user_func_array('sprintf', $args);
    }

    You can try:
    "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    See http://kb.mozillazine.org/Clearing_the_cache and http://kb.mozillazine.org/Cookies

  • Transformer tags in search web service results.

    Hiya All,
    I have a customer requirement to pass a transformer tag back from a search web service in the return record set. As part of the SWS the description and the OpenDocumentURL it will always contain references to existing portal objects.
    SearchRecord.Description = "<pt:openerLink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectID='210' pt:classID='512' pt:mode='2'>view community</pt:openerLink>";
    When this is being displayed through the portal federated search results the transformer tag is not being converted into a URL.
    The view source looks like
    <td valign="top" colspan="1" class="listSubtitle" >portlet test
    <span class="listText" ><pt:openerLink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectID='210' pt:classID='512' pt:mode='2'>view community</pt:openerLink></span></td>
    We are using .Net with the 5.1EDK against portal 5.0.4.
    Cheers
    Bob

    The only thing I can think of is upping your logging on the web server and see what you can find in there or on your WCA.  What application server are you using?

  • OSB transformation error- BEA-382513- Error parsing XML

    Hi Gurus -
    I am struggling to fix one OSB Xquery transformation error
    <con:errorCode>BEA-382513</con:errorCode>
    <con:reason>OSB Replace action failed updating variable "body": Error parsing XML: {err}FORG0005: expected exactly one item, got 0 items
    I am passing SIL formatted data to this transformation an expecting a transformation but its keep on failing, I have tested the transformation and thats looking good.
    This is my replace operation where I am doing transformation.
    Replace [ node contents ] of [ ./* ]
    in [ body ] with
    XQuery Resource: TestProject/Common/Transformation/XQJMS2DBTransformation
    Variable Names And Bindings:
    commonInterfaceLayout1 - $body/*:CommonInterfaceLayout
    transformation file
    (:: pragma bea:global-element-parameter parameter="$commonInterfaceLayout1" element="ns0:CommonInterfaceLayout" location="../../Common/Schema/CommonInterfaceLayout.xsd" ::)
    (:: pragma bea:global-element-return element="ns1:EaiAuditCollection" location="../../Common/Schema/XSD_InsertEAIAuditDBTable.xsd" ::)
    declare namespace ns1 = "http://xmlns.oracle.com/pcbpel/adapter/db/top/InsertEAIAuditDBTable";
    declare namespace ns0 = "http://eai.fpl.com/schema/CommonInterfaceLayout";
    declare namespace xf = "http://tempuri.org/ErrorHandlingR1V1/XQJMS2DB/";
    declare function xf:XQJMS2DB($commonInterfaceLayout1 as element(ns0:CommonInterfaceLayout))
    as element(ns1:EaiAuditCollection) {
    <ns1:EaiAuditCollection>
    <ns1:EaiAudit>
    <ns1:eaiAuditId></ns1:eaiAuditId>
    <ns1:messageId>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageId) }</ns1:messageId>
    <ns1:messageDate>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageReceivedDate) }</ns1:messageDate>
    <ns1:messageType>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageType) }</ns1:messageType>
    <ns1:messageSource>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageSource) }</ns1:messageSource>
    <ns1:messageTarget>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageTarget) }</ns1:messageTarget>
    <ns1:appUniqId>{ data($commonInterfaceLayout1/ns0:Header/ns0:ApplicationUniqueId) }</ns1:appUniqId>
    <ns1:payload>{ data($commonInterfaceLayout1/ns0:Body) }</ns1:payload>
    <ns1:componentName>{ data($commonInterfaceLayout1/ns0:Header/ns0:ComponentName) }</ns1:componentName>
    <ns1:clientId>{ data($commonInterfaceLayout1/ns0:Header/ns0:ClientId) }</ns1:clientId>
    <ns1:createDate>{ fn:current-date() }</ns1:createDate>
    <ns1:processFlag></ns1:processFlag>
    </ns1:EaiAudit>
    </ns1:EaiAuditCollection>
    declare variable $commonInterfaceLayout1 as element(ns0:CommonInterfaceLayout) external;
    xf:XQJMS2DB($commonInterfaceLayout1)
    pls advice whats wrong I am doing here.
    Edited by: KumarB on Feb 7, 2013 9:56 PM

    update - I dont see this error any more but transformation is not happening. as a result of transformation, i get same message as output .. no change in it.

  • XSLT Transformation ABAP to XML speacial treatment of empty elements

    Dear All,
    I have created a deep abap structure which basically reflects the structure of my XML file which I would like to generate later. I have created a transformation via transaction SE80->create XSLT Program. I am also using the ABAP command call transformation...
    I have made a few ammendments to my XSLT program where required.
    I am outputting data in a loop.
    But I got a problem with one field. I must check if this date field is initial.
    Which I did by using statement:
    <xsl:if test="ENDDATE='0000-00-00'">
    But if this field is initial I have to output the following tag:
    <ENDDATE ReasonForNull="9"></ENDDATE>
    Hence I defined an attribute below in my element as follows:
       <xsl:for-each select="INSTANCE/_-PIQGB_-INSTANCE_XML">
    <xsl:if test="ENDDATE='0000-00-00'">
       <xsl:element name="ENDDATE">
           <xsl:attribute name="ReasonForNull"/>  
        </xsl:element>
    </xsl:if>
       </xsl:for-each>
    Which generates now the output as follows and is quitwe close to the desired output:
    <ENDDATE ReasonForNull=""></ENDDATE>
    Can anybody make a suggestion how I can generate the desired output.
    I assume that I would have to assign a value to the attribute to get the right output. But I got no idea how I could this in the loop.
    Many thanks in advance.
    Rainer

    Hello Rainer
    The solution is quite simple. See the example below.
    " Sample XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="../tmp_EDI_ZZ_tests/Untitled2.xsl"?>
    <INVOIC02>
        <INSTANCE>
            <ENDDATE>2008-07-31</ENDDATE>
        </INSTANCE>
        <INSTANCE>
            <ENDDATE>0000-00-00</ENDDATE>
        </INSTANCE>
    </INVOIC02>
    " Stylesheet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output encoding="ISO-8859-1" method="xml" indent="yes"/>
        <xsl:template match="/*">
            <xsl:for-each select="INSTANCE">
                <xsl:choose>
                    <xsl:when test="ENDDATE='0000-00-00' ">
                        <xsl:element name="ENDDATE">
                            <xsl:attribute name="ReasonForNull">
                                <xsl:value-of select=" '9' "/>   " Set value for attribute !!!
                            </xsl:attribute>
                        </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="node()"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
        </xsl:template>
    </xsl:stylesheet>
    " Result of transformation:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ENDDATE>2008-07-31</ENDDATE>
    <ENDDATE ReasonForNull="9"/>
    Regards
      Uwe

  • Error while transforming XSLT by calling function with Reflection API

    Hi,
    I'm new to Reflection API. I want to call function from the jar file which is not in my application context. So I have loaded that jar ( say XXX.jar) file at runtime with URLClassLoader and call the function say [ *myTransform(Document document)* ]. Problem is that when I want to transform any XSLT file in that function it throws exception 'Could not compile stylesheet'. All required classes are in XXX.jar.
    If I call 'myTransform' function directly without reflection API then it transformation successfully completed.
    Following is code of reflection to invoke function
            ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
            URLClassLoader loader = new URLClassLoader(jarURLs, contextCL);
            Class c = loader.loadClass(fullClasspath);
            Constructor constructor = c.getDeclaredConstructor(constructorParamsClasses);
            Object instance = constructor.newInstance(constructorParams);
            Method method = c.getDeclaredMethod("myTransform", methodParamsClasses);
            Object object = method.invoke(instance, methodParams);Following is function to be called with reflection API.
    public Document myTransform ( Document document ) {
    // Reference of Document (DOM NODE) used to hold the result of transformation.
                Document doc = null ;
                // DocumentBuilderFactory instance which is used to initialize DocumentBuilder to create newDocumentBuilder.
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance () ;
                // Reference of DocumentBuilder used to create new Document (DOM NODE).
                DocumentBuilder builder;
                try {
                      // Initialize DocumentBuilder by using DocumentBuilderFactory instance.
                      builder = factory.newDocumentBuilder ();
                      // Initialize new document instance by using DocumentBuilder instance.
                      doc = builder.newDocument () ;
                      // Creates new DOMSource by using document (DOM NODE) which is coming through current transform() method parameter.
                      DOMSource domsource = new DOMSource ( document ) ;
                      // Creates new instance of TransformerFactory.
                      TransformerFactory transformerfactory = TransformerFactory.newInstance () ;
                      // Creates new Transformer instance by using TransformerFactory which holds XSLT file.
                      Transformer transformer = null;
    ********* exception is thrown from here onward ******************
                      transformer = transformerfactory.newTransformer (new StreamSource (xsltFile));
                      // Transform XSLT on document (DOM NODE) and store result in doc (DOM NODE).
                      transformer.transform ( domsource , new DOMResult ( doc ) ) ;
                } catch (ParserConfigurationException ex) {
                      ex.printStackTrace();
                } catch (TransformerConfigurationException ex) {
                      ex.printStackTrace();
                } catch (TransformerException ex) {
                     ex.printStackTrace();
                } catch (Exception ex) {
                     ex.printStackTrace();
                //holds result of transformation.
                return doc ;
    }Following is full exception stacktrace
    ERROR:  'The first argument to the non-static Java function 'myBeanMethod' is not a valid object reference.'
    FATAL ERROR:  'Could not compile stylesheet'
    javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:829)
            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:623)
            at com.actl.dxchange.utilities.Transformation.transform(Transformation.java:83)
            at com.actl.dxchange.base.BaseConnector.transform(BaseConnector.java:330)
            at com.actl.dxchange.connectors.KuoniConnector.doRequestProcess(KuoniConnector.java:388)
            at com.actl.dxchange.connectors.KuoniConnector.hotelAvail(KuoniConnector.java:241)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            ...........

    Hi,
    Thanks for response.
    Following is code for setting 'methodParamsClasses' array object. I do ensure that Document is not null and valid. My application is web application.
    Document requestObj = /* my code for generating Document object*/
    Object[] methodParams = new Object[]{requestObj}
    Class[] methodParamsClasses = new Class[]{};
                if (methodParams != null) {
                    methodParamsClasses = new Class[methodParams.length];
                    for (int i = 0; i < methodParams.length; i++) {
                        if (methodParams[i] instanceof Document) {
    /************** if parameter is instance of Document then I set class type as "Document.class" ***********/
                            methodParamsClasses[i] = Document.class;
                        } else {
                            methodParamsClasses[i] = methodParams.getClass();

  • CALL TRANSFORMATION on Unicode WebAS 6.20: No valid source context supplied

    Hello,
    in the last day's I was stuck into a strange problem. I had to develop a Web Service Client on our Web AS 6.20 Unicode system. I followed the Blog <a href="/people/durairaj.athavanraja/blog/2004/09/20/consuming-web-service-from-abap">Consuming Web Service from ABAP</a>. The problem was that my CALL TRANSFORMATION always throwed an exception "No valid source context supplied". I've tested the transformation with a local copy of the XML the Web Service returned and it works quite well. I had a look into the Documentaion of CALL TRANSFORMATION and it says:
    == Documentation Quote Begin ==
    Addition 3a
    ... SOURCE  XML sxml
    Effect
    Specification of the transformation source
    Transfer the XML document sxml using addition 3a. The following three possibilities exist for specifiying sxml:
    The XML document can be in an ABAP variable sxml of the type STRING or XSTRING or in an internal standard table sxml of the elementary line type C.
    == Documentation Quote End ==
    So there should be no difference between STRING and XSTRING. But there is a difference! Here is my testcase which I've derived from my Blog <a href="/people/gregor.wolf3/blog/2006/06/27/geocode-business-partner-with-google-maps">Geocode Business Partner with Google Maps</a>:
    <b>XSLT Transformation - ZGOOGLE_GEOCODE_TO_ABAP</b>
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asx="http://www.sap.com/abapxml" xmlns:kml="http://earth.google.com/kml/2.0" version="1.0">
      <xsl:template match="/">
        <asx:abap version="1.0">
          <asx:values>
            <GEOCODE>
              <LON>
                <xsl:value-of select="substring-before(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,',')"/>
              </LON>
              <LAT>
                <xsl:value-of select="substring-before(substring-after(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,','),',')"/>
              </LAT>
              <ALT>
                <xsl:value-of select="substring-after(substring-after(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,','),',')"/>
              </ALT>
            </GEOCODE>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    <b>ABAP Report</b>
    REPORT  z_gw_test_geocode.
    DATA:
    BEGIN OF geocode,
      lon TYPE string,
      lat TYPE string,
      alt TYPE string,
    END OF geocode.
    DATA: client TYPE REF TO if_http_client,
           url TYPE string,
           c_xml TYPE string,
           x_xml type xstring.
    * Build URL to call Googe Maps Geocoding
    CONCATENATE 'http://maps.google.com/maps/geo?'
      'q=Tacherting,+DE'
      '&output=xml'
      '&key=ABQIAAAA2WL-mG7HpdSjlxystL3uBhRvBuAcdiWwcJAQgt9kNvfse-yNqBQuxwHkHo31WjTJ_RzVPIhXNludVg'
      INTO url.
    ****Create the HTTP client
    CALL METHOD cl_http_client=>create_by_url
      EXPORTING
        url    = url
      IMPORTING
        client = client
      EXCEPTIONS
        OTHERS = 1.
    client->send( ).
    client->receive( ).
    ****Get the response content in Character format
    c_xml = client->response->get_cdata( ).
    ****Get the response content as Binary
    x_xml = client->response->get_data( ).
    ****Transform XML as String to ABAP Values
    DATA: xslt_err TYPE REF TO cx_xslt_exception,
          error_text TYPE string.
    WRITE: / 'Transformation with STRING'.
    TRY.
        CALL TRANSFORMATION zgoogle_geocode_to_abap
        SOURCE XML c_xml
        RESULT geocode = geocode.
      CATCH cx_xslt_exception INTO xslt_err.
        error_text = xslt_err->get_text( ).
        WRITE: / error_text.
    ENDTRY.
    WRITE: / 'LON: ', geocode-lon.
    WRITE: / 'LAT: ', geocode-lat.
    WRITE: / 'ALT: ', geocode-alt.
    ****Transform XML as XString to ABAP Values
    WRITE: / 'Transformation with XSTRING'.
    TRY.
        CALL TRANSFORMATION zgoogle_geocode_to_abap
        SOURCE XML x_xml
        RESULT geocode = geocode.
      CATCH cx_xslt_exception INTO xslt_err.
        error_text = xslt_err->get_text( ).
        WRITE: / error_text.
    ENDTRY.
    WRITE: / 'LON: ', geocode-lon.
    WRITE: / 'LAT: ', geocode-lat.
    WRITE: / 'ALT: ', geocode-alt.
    <b>Result</b>
    This is the result on our 6.20 Unicode System:
    Transformation with STRING
    No valid source context supplied
    LON:
    LAT:
    ALT:
    Transformation with XSTRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    I've tried it on our 6.20 and 6.40 NON-Unicode systems and the result was:
    Transformation with STRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    Transformation with XSTRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    Finaly I've tried it on our Solutin Manager 4.0 which runs on Web AS 7.00 and is also a Unicode installation. Here the result is correct:
    Transformation with STRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    Transformation with XSTRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    So now what to do? I've found nothing in OSS regarding this behaviour. Any tips? I also try a OSS Message.
    Regards
    Gregor

    Hi,
    Can you tell me about your project on short notes. For information.
    Regards
    R.Rajendran

  • XSLT transformation Bug?

    We are encountering a strage error and it is not always reproducible.
    Problem:
    content of one of the element has &; and in the initial transformation this is getting replaced by &#38;
    We are doing another transformation of this transformed xml file. This is where the transformation seems to not working correctly.
    for some of the elements &#38; is passed as is, on some of the elements , &#38; is replaced with &#38;#38 when ever this happens, the result will pickup all the elements after this element and treat them as text content for this element.
    ex
    Input1
    <?xml version="1.0" encoding="UTF-8"?>
    <Root>
    <item>
    <company>abc &; co</company>
    <addr1>1 xyz st</addr1>
    <addr2>zyz zyz</addr2>
    <city>xyz</city>
    </item>
    <item>
    <company>def &; co</company>
    <addr1>1 xyz st</addr1>
    <addr2>zyz zyz</addr2>
    <city>xyz</city>
    </item>
    <item>
    <company>ghi &; co</company>
    <addr1>1 xyz st</addr1>
    <addr2>zyz zyz</addr2>
    <city>xyz</city>
    </item>
    </Root>
    Result of transformation 1
    <?xml version="1.0" encoding="UTF-8"?>
    <Root>
    <item company="abc &#38; co" addr1="1 xyz st" addr2=" zyz zyz" city="xyz" />
    <item company="def &#38; co" addr1="1 xyz st" addr2=" zyz zyz" city="xyz" />
    <item company="ghi &#38; co" addr1="1 xyz st" addr2=" zyz zyz" city="xyz" />
    </Root>
    Result of transformation 2
    <?xml version="1.0" encoding="UTF-8"?>
    <Root>
    <item>
    <company>abc &#38; co</company>
    <addr1>1 xyz st</addr1>
    <addr2>zyz zyz</addr2>
    <city>xyz</city>
    </List>
    </item>
    <item>
    <company>def &#38;#38 co addr1="1 xyz st" addr2=" zyz zyz" city="xyz" />
    <item company="ghi &#38; co" addr1="1 xyz st" addr2=" zyz zyz" city="xyz" />
    </company>
    <addr1>1 xyz st </addr1>
    <addr2> zyz zyz</addr2>
    <city>xyz</city>
    </item>
    </Root>
    Transformation 2 for company element some times converts &#38; to &#38;#38; and when it does that will pick up next item elements.
    Any reason?
    null

    read & as &#38;#38 in the transformed xml

  • Transform error in 5.0

    Hi,
    I migrated from 1.4.2 to 1.5 recently and found that the xslt transformation that worked fine in 1.4.2 is now broke. The following is the problematic code segment
    try{
         System.out.println("Writing to: "+dirString+tableName+"Bean.java");
         File file = new File(dirString+tableName+"Bean.java");
         StreamResult sr = new StreamResult(file);
         System.out.println("Stream Result instantiated");
         transformer.transform(source, sr);
         System.out.println("Transform to file complete.");
    }catch (Exception e){
         System.out.println("OracleDriver WriteClassFile: "+e);
         e.printStackTrace();
    }The following is the output i get from an ant run:
         [java] Writing to: C:/dia/EntityGenerator/Generators/EntityGenerator_News_1
    0-14-04/generated/test/rss/ejb/NewsDefaultsBean.java
         [java] Stream Result instantiated
         [java] OracleDriver WriteClassFile: javax.xml.transform.TransformerExceptio
    n: java.io.FileNotFoundException: file:\C:\dia\EntityGenerator\Generators\Entity
    Generator_News_10-14-04\generated\test\rss\ejb\NewsDefaultsBean.java (The filena
    me, directory name, or volume label syntax is incorrect)
         [java] javax.xml.transform.TransformerException: java.io.FileNotFoundExcept
    ion: file:\C:\dia\EntityGenerator\Generators\EntityGenerator_News_10-14-04\gener
    ated\test\rss\ejb\NewsDefaultsBean.java (The filename, directory name, or volume
    label syntax is incorrect)
         [java]     at org.apache.xalan.transformer.TransformerImpl.createSerializat
    ionHandler(TransformerImpl.java:1137)
         [java]     at org.apache.xalan.transformer.TransformerImpl.createSerializat
    ionHandler(TransformerImpl.java:981)
         [java]     at org.apache.xalan.transformer.TransformerImpl.transform(Transf
    ormerImpl.java:1187)
         [java]     at org.apache.xalan.transformer.TransformerImpl.transform(Transf
    ormerImpl.java:1170)
         [java]     at dia.tools.EJBGeneration.OracleDriver.writeClassFile(OracleDri
    ver.java:432)
         [java]     at dia.tools.EJBGeneration.OracleDriver.generateEntity(OracleDri
    ver.java:633)
         [java]     at dia.tools.EJBGeneration.EntityGenerator.main(EntityGenerator.
    java:31)
         [java] Caused by: java.io.FileNotFoundException: file:\C:\dia\EntityGenerat
    or\Generators\EntityGenerator_News_10-14-04\generated\test\rss\ejb\NewsDefaultsB
    ean.java (The filename, directory name, or volume label syntax is incorrect)
         [java]     at java.io.FileOutputStream.open(Native Method)
         [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
         [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
         [java]     at org.apache.xalan.transformer.TransformerImpl.createSerializat
    ionHandler(TransformerImpl.java:1116)
         [java]     ... 6 more
         [java] ---------
         [java] java.io.FileNotFoundException: file:\C:\dia\EntityGenerator\Generato
    rs\EntityGenerator_News_10-14-04\generated\test\rss\ejb\NewsDefaultsBean.java (T
    he filename, directory name, or volume label syntax is incorrect)
         [java]     at java.io.FileOutputStream.open(Native Method)
         [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
         [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
         [java]     at org.apache.xalan.transformer.TransformerImpl.createSerializat
    ionHandler(TransformerImpl.java:1116)
         [java]     at org.apache.xalan.transformer.TransformerImpl.createSerializat
    ionHandler(TransformerImpl.java:981)
         [java]     at org.apache.xalan.transformer.TransformerImpl.transform(Transf
    ormerImpl.java:1187)
         [java]     at org.apache.xalan.transformer.TransformerImpl.transform(Transf
    ormerImpl.java:1170)
         [java]     at dia.tools.EJBGeneration.OracleDriver.writeClassFile(OracleDri
    ver.java:432)
         [java]     at dia.tools.EJBGeneration.OracleDriver.generateEntity(OracleDri
    ver.java:633)
         [java]     at dia.tools.EJBGeneration.EntityGenerator.main(EntityGenerator.
    java:31)I've verified that the path file:\C:\dia\EntityGenerator\Generators\EntityGenerator_News_10-14-04\generated\test\rss\ejb exists and since this is run on win xp i don't think its due to any file permission issues. Has something changed in 1.5 to cause my code to break? Thanks again,
    Regards,
    Sunil

    I replaced file with the filename string as input for StreamResult and everything works fine now. The following is the change i made
    try{
         System.out.println("Writing to: "+dirString+tableName+"Bean.java");
         StreamResult sr = new StreamResult(dirString+tableName+"Bean.java");
         System.out.println("Stream Result instantiated");
         transformer.transform(source, sr);
         System.out.println("Transform to file complete.");
    catch (Exception e){
         System.out.println("OracleDriver WriteClassFile: "+e);
         e.printStackTrace();
    }I checked the version of xalan i am using. It is the most current one and so i am not sure how it used to work in 1.4.2. Didn't find anything about this in the 5.0 documentation either. Thanks again for the help,
    Regards,
    Sunil

  • Xsl transformation of xml with wrong namespace

    I have xml with wrong namespace:
    <PAMStartedNotification xmlns="some site">
    <tUser>PLVUSER</tUser>
    </PAMStartedNotification>I need to leave this namespace and transform it.
    As a result of transformation now I get
    <tUser></tUser>
    ...I.e. XPath is not calculated properly.
    If I leave out that namespace then everything is ok.
    But I want to leave that namespace as it is.
    I use the following code to transform xml:
    Templates stylesheet = transformerFactory.newTemplates(new StreamSource(new File(fileName)));
    Transformer processor = stylesheet.newTransformer();
    java.io.StringWriter resultWriter = new java.io.StringWriter();
    StreamResult streamResult = new StreamResult(resultWriter);
    processor.transform(new StreamSource(new StringReader(xmlData)), streamResult);
    transformedXML = resultWriter.getBuffer().toString();Any ideas how to do that(transform xml with wrong namespace)?
    Edited by: prng on Dec 15, 2008 6:43 AM
    Edited by: prng on Dec 15, 2008 6:45 AM

    prng wrote:
    Sorry.
    Here is XPath I use to select tUser:
    /PAMStartedNotification/tUser
    Right. To start out, that selects a PAMStartedNotification element which is in no namespace. But yours isn't. It's in the default namespace, which doesn't have a prefix. You could try this XPath expression:
    /*[local-name() = 'PAMStartedNotification']/*[local-name() = 'tUser'](Untested, might have mis-typings and so on.)

  • Automatic insert of xmlns:xsl during XSLT transformation

    I am using the xmlparserv2.jar of dated "12/10/00" to perform a XSLT transformation. I need to insert a xml:space="preserve" attribute to a generated tag. However, there is an addition attribute added : xmlns:xml="http://www.w3/org/XML/1998/namespace". How can I suppress the generation of this attribute ?
    Here is my XML :
    <?xml version = '1.0' standalone = 'no'?>
    <COLDdoc>
    <Page template="bkgnd1" num="1">
    <Line num="1"> CN011A021C 1A021</Line>
    <Line num="2"> 1954.90 7713.36</Line>
    </Page>
    </COLDdoc>
    My XSL is :
    <?xml version = '1.0' standalone = 'yes'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="no" doctype-system="svg-20000303-stylable.dtd"/>
    <xsl:template match="Line">
    <text>
    <xsl:attribute name="x">0</xsl:attribute>
    <xsl:attribute name="y">
    <xsl:value-of select="@num*10"/>
    </xsl:attribute>
    <xsl:attribute name="xml:space">preserve</xsl:attribute>
    <xsl:value-of select="."/>
    </text>
    </xsl:template>
    </xsl:stylesheet>
    The result XSLT Transformation :
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE text SYSTEM "svg-20000303-stylable.dtd">
    <text x="0" y="10" xmlns:xml="http://www.w3/org/XML/1998/namespace" xml:space="preserve"> CN011A021C 1A021</text>
    <text x="0" y="20" xmlns:xml="http://www.w3/org/XML/1998/namespace" xml:space="preserve"> "> 1954.90 7713.36</text>
    Regards.
    Jeffrey
    null

    Hi Greg,
    please try it with the following (just slightly) modified transformation (works fine for me):
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                   xmlns:asx="http://www.sap.com/abapxml"
                   xmlns:sap="http://www.sap.com/sapxsl"
                   version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:template match="/PEXR2002/IDOC">
        <asx:abap version="1.0">
          <asx:values>
            <HEADER_DATA>
              <SNDPRN>
                <xsl:value-of select="EDI_DC40/SNDPRN"/>
              </SNDPRN>
              <BGMREF>
                <xsl:value-of select="E1IDKU1/BGMREF"/>
              </BGMREF>
              <MOABETR>
                <xsl:value-of select="E1IDKU5/MOABETR"/>
              </MOABETR>
              <CREDAT>
                <xsl:value-of select="EDI_DC40/CREDAT"/>
              </CREDAT>
              <DATUM>
                <xsl:value-of select="E1EDK03/DATUM"/>
              </DATUM>
            </HEADER_DATA>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    I recommend to test all transformations that you define on a sample source and check the output. If you apply your original transformation you would see that it basically doesn't select anything and therefore you just get an XML document with the field names but no values.
    Cheers, harald

  • Error using XMLType.transform() parammap argument

    Hello;
    I've hit a snag trying to pass top-level XSLT parameter via XMLType.transform's parammap argument.
    Whenever I run the code sample at the end of this message on 9.2.0.1.0, I get the following error:
    ORA-00600: internal error code, arguments: [KGHAL02], [0x0], [], [], [], [], [], []
    This error does not occur if you remove the 'name=value' parammap value.
    Any ideas?
    Brian.
    set serveroutput on
    declare
         stylesheet xmltype;
         result xmltype;
         xmldoc xmltype;
    begin
         stylesheet := XMLType(
    '<?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >
    <xsl:param name="name"/>
    <xsl:output
    method="xml"
    />
    <xsl:template match="hello" >
         <xsl:value-of select="text()"/>
    </xsl:template>
    </xsl:stylesheet>'
         xmldoc := XMLType('<hello>world </hello>');
         result := xmldoc.transform(stylesheet,'name=value');
         dbms_output.put_line(result.getStringVal());
    end;
    /

    I've worked around this bug successfully by using dbms_xslprocessor package directly - but yuck. The dbms_xslprocessor and related packages is pretty messy to work with.
    I also ran into problems implementing the workaround as dbms_xmldom.getDocumentElement could not find the root element on the resulting DOMDocumentFragment (converted appropriately using dbms_xmldom.makeDocument - sigh). I had to write the fragment (converted to a node first using dbms_xmldom.makeNode - heavy sigh) to a clob (dbms_xmldom.writeToClob), and then reload it using dbms_xmldom.newDOMDocument). Not to mention having to remember to freeXXX all the things I had to create.
    Gross... 4 times the code with lots more opportunities for bugs & leaks.
    Brian.

  • SAVE MY KEYBOARD- MySQL resources is invalid.

    I have two pages that both use the same include. I posted
    awhile back b/c
    one of them would not work. I came in, redid the page -
    VOILA! It worked.
    Now it doesn't. Somebody, please save my machine from a
    pounding!!!!!!
    Working page:
    http://demo.mediachurch.com/news.php
    Look at the News Highlights. This section is the section
    that, until this
    morning, was working OK on my main site.
    Nonworking page:
    http://demo.mediachurch.com
    This page has the following error on it. It looks like for
    some reason the
    SQL is not being read properly - but how could that be if
    it's being read on
    one page OK?
    Warning: mysql_num_rows(): supplied argument is not a valid
    MySQL result
    resource in /home/mdemo/public_html/app/nl_FrontPage.php on
    line 21
    SQL:
    THis is lines 1-23 on the nl_FrontPage.php file:
    $maxRows_rsFrontPage = $mcArticle;
    $pageNum_rsFrontPage = $mcPage;
    if (isset($_GET['pageNum_rsFrontPage'])) {
    $pageNum_rsFrontPage = $_GET['pageNum_rsFrontPage'];
    $startRow_rsFrontPage = $pageNum_rsFrontPage *
    $maxRows_rsFrontPage;
    mysql_select_db($database_mcDemo, $mcDemo);
    $query_rsFrontPage = "SELECT * FROM tblnews WHERE
    newsPublish = '2' ORDER
    BY newsOrder ASC";
    $query_limit_rsFrontPage = sprintf("%s LIMIT %d, %d",
    $query_rsFrontPage,
    $startRow_rsFrontPage, $maxRows_rsFrontPage);
    $rsFrontPage = mysql_query($query_limit_rsFrontPage,
    $mcDemo) or
    die(mysql_error());
    $row_rsFrontPage = mysql_fetch_assoc($rsFrontPage);
    if (isset($_GET['totalRows_rsFrontPage'])) {
    $totalRows_rsFrontPage = $_GET['totalRows_rsFrontPage'];
    } else {
    $all_rsFrontPage = mysql_query($query_rsFrontPage);
    $totalRows_rsFrontPage = mysql_num_rows($all_rsFrontPage);
    $totalPages_rsFrontPage =
    ceil($totalRows_rsFrontPage/$maxRows_rsFrontPage)-1;
    In the index file, it's linked like this:
    $mcArticle = 4;
    $mcPage =2;
    $fpStyle = 0;
    require("app/nl_FrontPage.php")
    In the news files it's a bit more complicated, as this page
    is only
    displayed after a few conditions are [not] met. However,
    nested in the if
    statemenst is this:
    $mcArticle = 4;
    $mcPage =2;
    $fpStyle = 1;
    require("app/nl_FrontPage.php")
    Does anybody have any general clues as to what I'm looking
    for? This is
    absolutely driving me nuts.
    TIA,
    Jon Parkhurst
    PriivaWeb
    http://priiva.net.

    Thanks for responding, Joe
    The query comes out fine (see here:
    http://demo.mediachurch.com/index2.php
    and when I run the SQL on the server, it give me exactly what
    I want.
    What's just *amazing* to me is that the other file it's
    included on should
    be the one that has problems.
    news.php
    includes display.php
    (if)includes nl_News.php
    (if)includes nl_FrontPage.php
    The index page has this:
    index.php
    includes nl_frontPage.php
    *sigh*. I"m going to takea break, i'll check back tomorrow
    when it's too
    hot outside to work (or when i just get Lazy)
    "Joe Makowiec" <[email protected]> wrote in
    message
    news:[email protected]..
    > On 01 Sep 2006 in macromedia.dreamweaver.appdev, crash
    wrote:
    >
    >> Warning: mysql_num_rows(): supplied argument is not
    a valid MySQL
    >> result resource in
    /home/mdemo/public_html/app/nl_FrontPage.php on
    >> line 21
    > [snip]
    >> Does anybody have any general clues as to what I'm
    looking for?
    >> This is absolutely driving me nuts.
    >
    > That error message, if I'm reading it right, tells me
    that the query was
    > never done[1], and you need to figure out why. What do
    you get if you
    > insert an echo here:
    >
    > } else {
    > // debugging echo goes here
    > echo 'Query: ' . $query_rsFrontPage;
    > // debugging echo goes here
    > $all_rsFrontPage = mysql_query($query_rsFrontPage);
    > $totalRows_rsFrontPage =
    mysql_num_rows($all_rsFrontPage);
    >
    > [1] or maybe it's returning a null result?
    >
    > --
    > Joe Makowiec
    >
    http://makowiec.net/
    > Email:
    http://makowiec.net/email.php

Maybe you are looking for