Formatting dates in xsl transformation

Hi:
We have a problem transforming dates inside an xls mapping. Date and Time come from different fields in DDBB, so the straight way should be extract year, month and day from date, hour from time, concat everything together and finally push that string to format-DateTime. Well, that works except when hour is lower than 10, format-dateTime does not write a leading 0 (does not convert from '1' to '01'). We have tried everything, and found that using ora:formatDate works well when used in an Assign activity, but we cannot use that function inside the xls mapping we need. This is an example line:
<xsl:value-of select="ora:formatDate('2001-01-01T1:00:00.000+01:00','yyyy-MM-dd HH:mm:ss')"/>
BPEL message is "Invalid XPath expression"
Does anybody know what are we doing wrong? This is driving me creasy..

format that ora:formatDate uses is at http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
it is normal that you get "Invalid XPath expression" this is not a XLST function; user dateTime(date, time) instead. for futhermore info check it out at http://www.w3.org/TR/xpath-functions/#durations-dates-times

Similar Messages

  • Writing dates through XSL transformations

    I have made an application that writes XML files through XSL transformations, using JAXP 1.1.
    The problem is that I have to write the current date in the output XML data. I think the only way to do this is by using XSL language bindings.
    Unfortunately JAXP 1.1 seems not to support any language binding.
    What should I do in order to achieve this goal?
    Thanks in advance.

    When you run the transformation, pass in the current date as a parameter to the top level of the XSLT. Then use that parameter in your transformation.

  • Xsl format date

    Hi,
    Can anybody give me an example of formatting date using xsl that works with the oracle xsl processor.
    I would like to convert a date string from something like '2004-11-15' to '111504' using xsl stylesheet.
    Does oracle 10g support xslt 2.0. I thought it did.
    Is there a documentation which lists all the functions/elements of xslt 2.0 supported by oracle 10g.
    thanks in advance
    phani

    You didn't say how you are invoking your xslt and which release of the database. If you are using the 'C' based engine (via DBMS_XMLPROCESSOR, the SQL XMLTRANSFORM function or the XMLType TRANSFORM method then we currently only support XSLT 1.0.
    In 10gR2 we do support the majority of the functions and operators that are common to XQuery and XSLT 2.0 but only for use in XQuery. Depending on what you are doing XQuery may be an alterntive way of generating the required transformation.
    Oracle XDK/J does provide support for XSLT 2.0.
    The only way I can think of to do what you are trying to do would be using XSLT string and concatentaion functions...
    Something similar to the following
    <xsl:template name="formatDate">
              <xsl:param name="date"/>
              <!-- Day -->
              <xsl:value-of select="substring($date, 9, 2)"/>&#160;
              <!-- Month -->
              <xsl:variable name="month" select="number(substring($date, 6, 2))"/>
              <xsl:choose>
                   <xsl:when test="$month=1">Jan</xsl:when>
                   <xsl:when test="$month=2">Feb</xsl:when>
                   <xsl:when test="$month=3">Mar</xsl:when>
                   <xsl:when test="$month=4">Apr</xsl:when>
                   <xsl:when test="$month=5">May</xsl:when>
                   <xsl:when test="$month=6">Jun</xsl:when>
                   <xsl:when test="$month=7">Jul</xsl:when>
                   <xsl:when test="$month=8">Aug</xsl:when>
                   <xsl:when test="$month=9">Sep</xsl:when>
                   <xsl:when test="$month=10">Oct</xsl:when>
                   <xsl:when test="$month=11">Nov</xsl:when>
                   <xsl:when test="$month=12">Dec</xsl:when>
                   <xsl:otherwise>INV</xsl:otherwise>
              </xsl:choose>&#160;
              <!-- Year -->
              <xsl:value-of select="substring($date, 1, 4)"/>&#160;<xsl:value-of select="substring($date, 12, 5)"/>
         </xsl:template>

  • ESB XSL Transform failure

    Hi
    I have an ESB project in JDev 10.1.3.3 which has a routing service to a Database Adapter. The adapter correctly executes the query, retruning the correct single row. I transform the data, us XSL transform, however, this fails - with no errors, and does not perfrom the transform. The transform tests correctly in JDeveloper and is retrieved successfully at runtime.
    Has anyone come accross this before?
    I am using 10.1.3.3 JDev and SOA Suite connecting to an 11g Oracle Database.
    Cheers
    Matt

    Hi James
    There is a full record set coming back. Below is a post from log.xml - there are no errors pertainnig to this I can find in any log. I tested the appropriate routing service, setting the log level to finest, and there are no errors for that test other than the one I describe.
    Cheers
    Matt
    Message Text
    Transforming response
    <CpePhysicalDeviceCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/NoEndpointDatabaseAdapter">
    <CpePhysicalDevice>
    <cpePhysicalDeviceId>186</cpePhysicalDeviceId>
    <startDate>2008-01-03T00:00:00.000+13:00</startDate>
    <endDate>2999-12-31T00:00:00.000+13:00</endDate>
    <cpeId>10000074</cpeId>
    </CpePhysicalDevice>
    </CpePhysicalDeviceCollection>
    using XSLT "esb:///ESB_Projects/temp_soa_project_copy_MQToESB_chchxp0083/CpePhysDeviceHistoryCollection_To_QueuableMessage.xsl"
    Log Message: September 4, 2008 11:09:21 AM NZST
         Component Name          tip          Component ID          tip
         Host Network Address          172.28.3.10          Message Level          1
         Module ID          esb.server.common.cache          User ID          SYSTEM
         Execution Context ID          1220483360:172.28.3.10:5028:4132:30          Execution Context Sequence          5
         Host Name          CHCHXP0083          Thread ID          28
         Message Type          Trace          J2EE Application Module          provider-war
         J2EE Application          esb-rt          Web Service Port          __soap_WhichAdapter_execute_ppt
         Web Service Name          ESB_WhichAdapter_Service                    
    Message Text
    Retrieving cached object for "esb:///ESB_Projects/temp_soa_project_copy_MQToESB_chchxp0083/CpePhysDeviceHistoryCollection_To_QueuableMessage.xsl".
    Log Message: September 4, 2008 11:09:21 AM NZST
         Component Name          tip          Component ID          tip
         Host Network Address          172.28.3.10          Message Level          1
         Module ID          esb.server.service          User ID          SYSTEM
         Execution Context ID          1220483360:172.28.3.10:5028:4132:30          Execution Context Sequence          5
         Host Name          CHCHXP0083          Thread ID          28
         Message Type          Trace          J2EE Application Module          provider-war
         J2EE Application          esb-rt          Web Service Port          __soap_WhichAdapter_execute_ppt
         Web Service Name          ESB_WhichAdapter_Service                    
    Message Text
    Transformed response
    <out1:QueuableMessage xmlns:out1="http://www.arcinnovations.com/schema/conversion/1.0">
    <out1:cpeNumber/>
    </out1:QueuableMessage>

  • XSL Transformation to Oracle Canonical Format

    XSL Transformation to Oracle Canonical Format
    Posted: Aug 6, 2007 9:31 AM Reply
    I am having issues with transforming XML into Oracle Canonical Format. Can someone, please tell me what am doing wrong?
    The source XML:
    <transform>
    <key old="driver" new="3" transform1="specified">
    <value old="-1" new="-1" description="NA" />
    <value old="0" new="0" description="no" />
    <value old="1" new="1" description="yes" />
    </key>
    </transform>
    I must transform it with XSL into Oracle Canonical format:
    <ROWSET>
    <ROW>
    <column_name_1 />
    <column_name_2 />
    <column_name_3 />
    </ROW>
    <ROW>
    <column_name_1 />
    <column_name_2 />
    <column_name_3 />
    </ROW>
    </ROWSET>
    So, I came up with this stylesheet.
    <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <ROWSET table = "table4xml">
    <ROW num ="1">
    <KEY_OLD>
    <xsl:value-of select="@old" />
    </KEY_OLD>
    <KEY_NEW>
    <xsl:value-of select="@new" />
    </KEY_NEW> <TRANSFORM1>
    <xsl:value-of select="@transform1" />
    </TRANSFORM1>
    <VALUEOLD>
    <xsl:value-of select="@valueold" />
    </VALUEOLD>
    <VALUENEW>
    <xsl:value-of select="@valuenew" />
    </VALUENEW>
    <DESCRIPTION>
    <xsl:value-of select="@description" />
    </DESCRIPTION>
    </ROW>
    </ROWSET>
    </xsl:template>
    </xsl:stylesheet>
    Table TABLE4XML
    KEY
    KEY_OLD
    KEY_NEW
    TRANSFORM1
    VALUEOLD
    VALUENEW
    DESCRIPTION
    I must have made a mistake within the XSL code, because the PL/SQL procedure that am using inserts a row of NULLs into the table.
    Am I correct that the given XML file should look in canonical format as this??
    <ROWSET>
    <ROW>
    <key>
    <old>driver</old>
    <new>3</new>
    <transform1>specified</transform1>
    <value>
    <old>-1</old>
    <new>-1</new>
    <description>NA</description>
    </value>
    </key>
    </ROW>
    </ROWSET>

    There is a misunderstanding in your question. Oracle canonical format has a root node named <rowset> and its children have the name of <row>. And its grandchildren have the name of <column>. This is all of canonical family, no other grand-grand-children :)
    Also here is an example for null values in canonical format. They are not presented in XML.
    SQL> set serveroutput on
    SQL> select null "col1", 'data' "col2" from dual;
    c col2
    data
    SQL> DECLARE
    2 ctx dbms_xmlgen.ctxHandle;
    3 xml CLOB;
    4 BEGIN
    5 ctx := dbms_xmlgen.newContext('select null "col1", ''data'' "col2" from dual');
    6 dbms_output.put_line(ctx);
    7
    8 xml := dbms_xmlgen.getXML(ctx);
    9 dbms_output.put_line(xml);
    10
    11 dbms_xmlgen.closeContext(ctx);
    12 END;
    13 /
    8
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <col2>data</col2>
    </ROW>
    </ROWSET>
    PL/SQL procedure successfully completed.
    Best Regards
    Erturk

  • GenericSortFilter.xsl unable to filter data in inline transformation.

    Hi,
        I am working on MII 12.0
        I need to filter an xml output of transaction. So I am using the inline transformation.
        I am passing filter column name, filter column value, filter exp and filter type.
        But the data is not getting filtered.
        When I am applying inline transformation for sorting, the data is getting sorted.
        When I apply generic sort filter action block in transaction to filter the data, itu2019s getting     filtered.
        Need help on this.
    Thanks
    Vishal Jadhav

    Hi,
        We can use generic sort filter in BLS.
        But MII has provided XLS transformation facility.
      I checked the xsl file used in genericsortfilter case.
      A code fragment is below
    <xsl:when test="$FilterType = 'lt'">
                                                 <xsl:choose>
                                                      <xsl:when test="$TestValue &lt; $FilterValue">Y</xsl:when>
                                                      <xsl:otherwise>N</xsl:otherwise>
                                                 </xsl:choose>          
    As you can see , instead of checking the FilterExp , it is checking the FilterType.
    That's where the problem lies.
    I made the necessary changes and now its working fine through the XSL transformation.
    Regards,
    Vishal Jadhav

  • CPO XSL Transform for CPSC Form data with Grid

    Does anyone have an XSL Transform worked out that conveniently parses the CPSC Form output from Service Link when it has a grid in it?
    For example the data from CPSC Service Link might look like:
    <root>
       <Common>
          <Action ClassID="">Some Action</Action>
          <RequisitionID>123</RequisitionID>
       </Common>
       <Attributes/>
       <FormData>
          <Dictionary.Field>Some Data</Dictionary.Field>
          <DictionaryWithGrid-1.Field1>somevalue</DictionaryWithGrid-1.Field1>
          <DictionaryWithGrid-1.Field2>someothervalue</DictionaryWithGrid-1.Field2>
          <DictionaryWithGrid-1.Field3>yetanothervalue</DictionaryWithGrid-1.Field3>
          <DictionaryWithGrid-2.Field1>somevalue2</DictionaryWithGrid-2.Field1>
          <DictionaryWithGrid-2.Field2>someothervalue2</DictionaryWithGrid-2.Field2>
          <DictionaryWithGrid-2.Field3>yetanothervalue2</DictionaryWithGrid-2.Field3>
       </FormData>
    </root>
    So the desired output would be
    <Row>
       <Field1>somevalue</Field1>
       <Field2>someothervalue</Field2>
       <Field3>yetanothervalue</Field3>
    </Row>
    <Row>
       <Field1>somevalue2</Field1>
       <Field2>someothervalue2</Field2>
       <Field3>yetanothervalue2</Field3>
    </Row>
    I'm having difficulty getting the right XSL select when the tag is something like 'DictionaryWithGrid-#.Field'.
    Thanks!

    That worked great, Svetlana!  Thank you very much for the help.
    I made some slight mods to make it even more portable and intuitive for XSL/XML beginners.
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <!-- Replace CHANGEME below with the name of the CPSC Form Dictionary to transform -->
    <xsl:variable name="Dictionary">CHANGEME</xsl:variable>
    <xsl:template match="root">
      <Table>
          <xsl:call-template name="ProcessOne">
            <xsl:with-param name="pos" select="1" />
          </xsl:call-template>
      </Table>
    </xsl:template>
      <xsl:template name="ProcessOne">
        <xsl:param name="pos" />
        <xsl:variable name="RowName" select="concat($Dictionary, '-', $pos)" />
        <xsl:if test="FormData/*[starts-with(name(), $RowName)] != ''">
          <Row>
            <xsl:for-each select="FormData/*[starts-with(name(), $RowName)]">
              <xsl:if test="starts-with(name(.), $RowName)">
                <xsl:variable name="FieldName" select="substring-after(name(.), '.')"/>
                <xsl:element name="{$FieldName}">
                  <xsl:value-of select="."/>
                </xsl:element>
              </xsl:if>
            </xsl:for-each>
          </Row>
          <xsl:call-template name="ProcessOne">
            <xsl:with-param name="pos" select="number($pos+1)" />
          </xsl:call-template>
        </xsl:if>
      </xsl:template>
    </xsl:stylesheet>

  • XSL transformation with xsl:import generates exceptions

    I am using the Schematron's basic XSL file basic-schematron.xsl to validate the XML format of one of our data files. The XSL file looks something like this
    ================
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
    <xsl:import href="skeleton1-5.xsl"/>
    <xsl:template name="process-prolog">
    <axsl:output method="text" />
    </xsl:template>
    ==================
    But, the validation fails while trying to run the transformation on my Schematron input file using this basic-schematron.xsl with java.lang.NoSuchMethodError:
    ======= OUTPUT ============
    Markup Error: no match attribute on <key> outside <rule>
    Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: GregorSamsa.process$dash$root(Lcom/sun/org/apache/xalan/internal/xsltc/DOM;Lcom/sun/org/apache/xml/internal/dtm/DTMAxisIterator;Lcom/sun/org/apache/xml/internal/serializer/SerializationHandler;ILjava/lang/Object;)V
         at GregorSamsa.applyTemplates()
         at GregorSamsa.applyTemplates()
         at GregorSamsa.transform()
         at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:594)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:640)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
         at com.solipsa.xsdvalidator.XSDValidator.validateSchematron(XSDValidator.java:137)
         at com.solipsa.xsdvalidator.XSDValidator.validate(XSDValidator.java:181)
         at com.solipsa.xsdvalidator.XSDValidatorUI.jButton1ActionPerformed(XSDValidatorUI.java:244)
         at com.solipsa.xsdvalidator.XSDValidatorUI.access$300(XSDValidatorUI.java:21)
         at com.solipsa.xsdvalidator.XSDValidatorUI$4.actionPerformed(XSDValidatorUI.java:140)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1766)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ============= OUTPUT ==============
    I tried the individual JAXP 1.3 for J2SDK 1.4.2 (Using the -Djava.endorsed.dirs JVM param) and tried the JDK 1.5.0_02 which has JAXP 1.3 inbuilt and they all fail.
    I tried the above with separate Xalan/Xerces jar files, and then it works fine.
    The problem seems to be somthing specific to the JAXP 1.3 environment. I can provide more details, if required. Any help is highly appreciated.

    One morning your code woke up and found it had been transformed into a giant insect.
    But seriously, here's the name of the method that doesn't exist:GregorSamsa.process$dash$rootIs GregorSamsa your class? Maybe your server has an old version of it which is missing that method? (Or: those $ signs look strange to me, maybe they are a mistranslation of some other character?)

  • XSL transformation not working

    Hi!
    I am having problems when trying to generate XSL transformation from XML to XML (where XML output is actually XHTML). It always fails executing <xsl:callTemplate name="something", when <xsl:callTemplate /> is executed from another <xsl:template> which is also called with <xsl:callTemplate. Version of database is 10.2.0.4.0, received error is: ORA-00604: invalid character value 'burek' for attribute 'name'.
    Transformation is working in Java and Altova XMLSpy.
    PL/SQL code:
    procedure process_xsl(p_xml in clob, p_xsl in clob, p_result out clob) is
    w_xsl_proc dbms_XSLProcessor.Processor;
    w_xsl_ss dbms_XSLProcessor.Stylesheet;
    w_dom_xsl dbms_xmldom.DOMDocument;
    w_dom_xml dbms_xmldom.DOMDocument;
    w_parser dbms_xmlparser.Parser;
    begin
    --xml in xsl iz cloba v DOMDocument
    w_parser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseClob(w_parser, p_xml);
    w_dom_xml := dbms_xmlparser.getDocument(w_parser);
    dbms_xmlparser.freeParser(w_parser);
    w_parser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseClob(w_parser, p_xsl);
    w_dom_xsl := dbms_xmlparser.getDocument(w_parser);
    dbms_xmlparser.freeParser(w_parser);
    --xsl procesiranje
    w_xsl_proc := dbms_XSLProcessor.newProcessor;
    w_xsl_ss := dbms_XSLProcessor.newStylesheet(w_dom_xsl, null); <-- Here error is received
    END;
    Stylesheet:
    <?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" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></xsl:output>
         <xsl:decimal-format name="dec" decimal-separator="," grouping-separator="."/>
         <!-- Predefined constants from einvoice xml schema -->
         <xsl:variable name="einvoiceIssuerCode" select="'II'"></xsl:variable>
         <xsl:variable name="einvoiceRecipientCode" select="'IV'"></xsl:variable>
         <xsl:variable name="einvoiceIssueLocationCode" select="91"></xsl:variable>
         <xsl:variable name="einvoiceIssueDateCode" select="137"></xsl:variable>
         <!-- Constants directly from document which is a part of transformation -->
         <xsl:variable name="einvoiceNumber" select="/IzdaniRacunEnostavni/Racun/GlavaRacuna/StevilkaRacuna/text()"></xsl:variable>
         <!-- Intro template -->
         *<xsl:template name="burek"> <!-- Second template called with xsl:call template -->*
              <xsl:text>TEST</xsl:text>
         </xsl:template>
         <!-- Template in which we create html structure including css -->
         <xsl:template name="einvoice">
              <html xmlns="http://www.w3.org/1999/xhtml">
              <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                   <title>Vizualizacija e-računa št. </title>
                   <xsl:call-template name="burek"></xsl:call-template>
              </head>
              <body>
              </body>
              </html>
         </xsl:template>
         <!-- Intro template -->
         <xsl:template match="/">
    *          <xsl:call-template name="einvoice"></xsl:call-template> <!-- This call is OK -->*
         </xsl:template>
    </xsl:stylesheet>
    XML document
    <?xml version="1.0" encoding="UTF-8"?>
    <IzdaniRacunEnostavni>
    <Racun Id="data">
    <GlavaRacuna>
    <VrstaRacuna>380</VrstaRacuna>
    <StevilkaRacuna>1205019908211</StevilkaRacuna>
    <FunkcijaRacuna>9</FunkcijaRacuna>
    </GlavaRacuna>
    <DatumiRacuna>
    <VrstaDatuma>137</VrstaDatuma>
    <DatumRacuna>2012-05-07T00:00:00.0Z</DatumRacuna>
    </DatumiRacuna>
    <DatumiRacuna>
    <VrstaDatuma>263</VrstaDatuma>
    <DatumRacuna>2012-04-28T00:00:00.0Z</DatumRacuna>
    </DatumiRacuna>
    <DatumiRacuna>
    <VrstaDatuma>263</VrstaDatuma>
    <DatumRacuna>2012-05-27T00:00:00.0Z</DatumRacuna>
    </DatumiRacuna>
    <DatumiRacuna>
    <VrstaDatuma>263</VrstaDatuma>
    <DatumRacuna>2012-03-28T00:00:00.0Z</DatumRacuna>
    </DatumiRacuna>
    <DatumiRacuna>
    <VrstaDatuma>263</VrstaDatuma>
    <DatumRacuna>2012-04-26T00:00:00.0Z</DatumRacuna>
    </DatumiRacuna>
    <DatumiRacuna>
    <VrstaDatuma>263</VrstaDatuma>
    <DatumRacuna>2012-04-27T00:00:00.0Z</DatumRacuna>
    </DatumiRacuna>
    <Lokacije>
    <VrstaLokacije>91</VrstaLokacije>
    <NazivLokacije>Ljubljana</NazivLokacije>
    </Lokacije>
    </Racun>
    </IzdaniRacunEnostavni>
    Edited by: 938026 on 01-Jun-2012 00:35

    Hi,
    I think your problem lies in the <title>. You are using non UTF-8 characters in the title (š), but you marked your XML as UTF-8. So change the title to have unicode charaters and it will work.
    Herald ten Dam
    http://htendam.wordpress.com

  • XSL Transformation won't run in Web Start

    Hello,
    I am using the javax.xml.transform.Transformer implementation built into Java 1.5.x to transform an XML document into HTML using an XSLT transformation source. This code works perfectly if I run the app outside of Java Web Start. However, if I run the app in web start, the output is partial. More specifically, the XML and the XSLT load just fine in web start (I've confirmed this), but the end result of the Transformation is a properly formatted HTML document with only part of the data -- a bunch of data is missing.
    I have some loops in the XSLT that print out rows in an HTML table with the data I want to see. These loops don't seem to run when I'm in web start, but the rest of the transformation does run.
    I've confirmed this is not working on both Mac OS and Windows, version 1.5.0_06 and 1.5.0_09. So I don't think it is a bug on any particular platform. I am totally stumped by this. The XSL transformation process is doing something different in web start than it does when run from the command line (either different jars are in play, or system properties are different, etc).
    Has anyone else experienced this?
    Thank You,
    Eric

    One thing I'd like to mention...
    My XML document has no namespace defined, and neither does my XSLT transform document. I am just referencing plain old string element names that simply match between the XML and XSLT. This all works fine when the Transform is run from a java app that is started on the command line. Things break down when the app is run via Java Web Start. Could the namespace issue be the problem, however? I don't see how that could be as the code works from a 'normal' java app, but maybe I'm missing something.

  • Unused xml tags being printed in xsl transformation

    Hi,
    I'm just starting out with xslt, and I am have a small problem with unused data being added into the html output from an xsl transformation. The data set is very small and the transdorm is not complicated, but when I do a
    <xsl:template match="aa/bb/cc">
    <title><xsl:value-of select"."/></title>
    </xsl:template>
    cc will be used as the title, but aa/bb/dd and aa/bb/ee will be printed to the output stream directly after the </title> as standard text.
    <title>cc</title>ddee
    I have include the xml, the transform and the html source recieved at the end of this mail.
    Any help would be appreciated.
    Cheers
    Simon
    <webpage>
      <project>
        <title>Katrin</title>
        <version>Version 1.0</version>
        <start_date>01/01/2003</start_date>
      </project>
    </webpage>
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <xsl:output method="html"/>
        <!-- template rule matching source root element -->
        <xsl:template match="/">
            <html>
                <head>
                    <xsl:apply-templates mode="head"/>
                </head>
                <!-- Construct main body of page -->
                <body>
                    <xsl:apply-templates/>
                </body>
            </html>
        </xsl:template>
        <!-- Head -->
        <xsl:template match="webpage/project/title" mode="head">
            <title><xsl:value-of select="."/></title>
        </xsl:template>
        <!-- Body -->
        <xsl:template match="webpage/project/title">
            <h1><xsl:value-of select="."/></h1>
        </xsl:template>
        <xsl:template match="webpage/project/version">
            <div align="right" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : red"><xsl:value-of select="."/></div>
        </xsl:template>
        <xsl:template match="webpage/project/start_date">
            <div align="left" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : blue"><xsl:value-of select="."/></div>
        </xsl:template>
    </xsl:stylesheet>
    <html xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <head>
          <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <title>Katrin</title>Version 0.101/01/2003</head>
       <body>
          <h1>Katrin</h1>
          <div align="right" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : red">Version 0.1</div>
          <div align="left" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : blue">01/01/2003</div>
       </body>
    </html>

    You had a couple of errors in your xsl. It should read something like:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="*|/"><xsl:apply-templates/></xsl:template>
    <xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>
    <xsl:template match="*|/">
    <html>
    <head><title>Greeting</title></head>
    <body>Words of greeting:
    <b><i><u><xsl:value-of select="greeting"/></u></i></b>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    This produces the result you are looking for:
    <html>
    <head>
    <title>Greeting</title>
    </head>
    <body>Words of greeting:
    <br>
    <b>
    <i>
    <u>Hello World.</u>
    </i>
    </b>
    </body>
    </html>
    null

  • Javax.xml.transform.TransformerException durin XSL Transformation in Java

    Hi,
    Below is my piece of code where i access a web service that returns a xml as a string. I apply a xsl tranformation on it and try to store the result as a string. I get this error message
    javax.xml.transform.TransformerException: Result object passed to ''{0}'' is invalid.
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(Unknown Source)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
         at NewService.main(NewService.java:52)My Code:
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.StringReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.rmi.RemoteException;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.ServiceException;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    public class NewService {
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              String endPoint = "http://localhost:8080/SampleDynamicWebProj/services/SampleClient";
              Service service = new Service();
              Call callOne;
              try {
                   callOne = (Call) service.createCall();
                   callOne.setTargetEndpointAddress(new URL(endPoint));
                   callOne.setOperationName(new QName("http://DefaultNamespace",
                             "getXMLString"));
                   String concated = (String) callOne.invoke(new Object[] { "s" });
                   InputStream xsltFile = new FileInputStream("xslpackage/empTran.xsl");
                   Source xmlSource = new StreamSource(new StringReader(concated));
                 Source xsltSource = new StreamSource(xsltFile);
                 TransformerFactory transFact =
                    TransformerFactory.newInstance();
                 Transformer trans = transFact.newTransformer(xsltSource);
                 Result result = new StreamResult();
                 trans.transform(xmlSource, result);
                 System.out.println(result.toString());
              } catch (ServiceException e) {
                   e.printStackTrace();
              } catch (MalformedURLException e) {
                   e.printStackTrace();
              } catch (RemoteException e) {
                   e.printStackTrace();
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (TransformerConfigurationException e) {
                   e.printStackTrace();
              } catch (TransformerException e) {
                   e.printStackTrace();
    }I get the transformed XML into a Result object, but when i do a toString() oon it, i get the above exception.
    any help wil be appreciated,
    Dilip

    Oh well, yes it was a typo in address tag...ok agreed that its a bad example, check this out then,
    i have a XML data that i convert to a html format using xsl transformation, now this converted html has to be shown in a html page(i use the out.write option).
    so my initial xml looks like this ::
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Results>
        <ColumnCount>6</ColumnCount>
        <Columns>
            <column>UID</column>
            <column>UserName</column>
            <column>Password</column>
            <column>LastName</column>
            <column>FirstName</column>
            <column>EmailAddress</column>
        </Columns>
        <Rows>
            <Row>
                <value>1</value>
                <value>userone</value>
                <value>password-1</value>
                <value>Anant</value>
                <value>Dilip</value>
                <value>[email protected]</value>
            </Row>
            <Row>
                <value>2</value>
                <value>usertwo</value>
                <value>password-2</value>
                <value>Palli</value>
                <value>Gilli</value>
                <value>[email protected]</value>
            </Row>
        </Rows>I apply XSL transformation on this to get a HTML which i will be writing into my output screen hoping that the user will see it in a tabular format!
    <[!CDATA["
    <?xml version="1.0" encoding="UTF-8"?>
    <table border="1">
    <tr bgcolor="#9acd32">
    <th align="left">UID</th>
    <th align="left">UserName</th>
    <th align="left">Password</th>
    <th align="left">LastName</th>
    <th align="left">FirstName</th>
    <th align="left">EmailAddress</th>
    </tr>
    <tr>
    <td>1</td>
    <td>userone</td>
    <td>password-1</td>
    <td>Anant</td>
    <td>Dilip</td>
    <td>[email protected]</td>
    </tr>
    <tr>
    <td>2</td>
    <td>usertwo</td>
    <td>password-2</td>
    <td>Palli</td>
    <td>Gilli</td>
    <td>[email protected]</td>
    </tr>
    </table>
    "]]>The entire data is passed to a XML parser . I want the transformed xml data (which will be inside a <status></status> tag to be untouched by this parser. As you see i have put the transformed xml in a CDATA tag, but this aint helping me...
    need urgent help,
    Dilip

  • XSL Transform, double-byte characters and padding

    I have a stylesheet with the following variable that is being formatted to pad a parameter named textQualifierDescription to a length of 30 by calling the template called format-string.
    <xsl:variable name="textQualifierDescription2">
         <xsl:call-template name="format-string">
              <xsl:with-param name="myString" select="$textQualifierDescription"/>
              <xsl:with-param name="numbatchspaces">30</xsl:with-param>
         </xsl:call-template>
    </xsl:variable>
    <xsl:template name="format-string">
         <xsl:param name="myString" select="' ' "/>
         <xsl:param name="numbatchspaces" select="20"/>
         <xsl:param name="direction" select="right"/>
         <xsl:variable name="spacesstr" select="string('                                              ')"/>
         <xsl:variable name="padsize" select="$numbatchspaces -string-length($myString)"/>
         <xsl:variable name="spacepad" select="substring($spacesstr, 1, $padsize)"/>
         <xsl:choose>
              <xsl:when test="$direction = 'left'">
                   <xsl:value-of select="concat($spacepad,$myString)"/>
              </xsl:when>
              <xsl:otherwise>
                   <xsl:value-of select="concat($myString,$spacepad)"/>
              </xsl:otherwise>
         </xsl:choose>
    </xsl:template>I execute the xsl transform using the following statement in a stored procedure:
    transformedData := xmldata.transform(xsldata);The xsl transform works as expected until it encounters data that contains double-byte characters. My output is supposed to contain the following three fields as a single record
    textQualifierDescription - padded to a length 30
    lineNumber
    id
    If my textQualifierDescription contains a value of "Texto de posición"
    Line 1 - Texto de posición             00000001POS2005
    Line 2 - Texto de posición            00000001POS2005
    Line 1 is the expected result.
    Line 2 is the actual result. When the "format-string" function is called and even though "Texto de posición" is 17 characters in length, it looks as if oracle counts the double-byte character as 2 and calculates the string-length as 18 to come up with a padsize of 12. It then creates a spacepad of 12 spaces which is then concatenated to the 17 characters for a total length of 29. I have tested the stylesheet in xmlspy and it produces the expected result.
    Has anyone ever run into this sort of situation and is able to provide me with some sort of solution to this dilemma? This is running on 10g Release 10.2.0.4.0.

    Your searches should have also come up with the fact that CR XI R2 is not supported in .NET 2008. Only CR 2008 (12.x) and Crystal Reports Basic for Visual Studio 2008 (10.5) are supported in .NET 2008. I realize this is not good news given the release time line, but support or non support of cr xi r2 in .net 2008 is well documented - from [Supported Platforms|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7081b21c-911e-2b10-678e-fe062159b453
    ] to [KBases|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do], to [Wiki|https://wiki.sdn.sap.com/wiki/display/BOBJ/WhichCrystalReportsassemblyversionsaresupportedinwhichversionsofVisualStudio+.NET].
    Best I can suggest is to try SP6:
    https://smpdl.sap-ag.de/~sapidp/012002523100015859952009E/crxir2win_sp6.exe
    MSM:
    https://smpdl.sap-ag.de/~sapidp/012002523100000634042010E/crxir2sp6_net_mm.zip
    MSI:
    https://smpdl.sap-ag.de/~sapidp/012002523100000633302010E/crxir2sp6_net_si.zip
    Failing that, you will have to move to a supported environment...
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Edited by: Ludek Uher on Jul 20, 2010 7:54 AM

  • Format-date is not in xp20

    Hi I would like to call
    format-date($d, "[D] [MNn] [Y]", "en", "OS", ())
    in my xsl transformation but this is not in xp20 xpath library. What should i do inorder to call this function?

    Hi,
    some function are not available in transformations. You have to use an assign first...

  • LrXML xsl transform cannot match document node on windows

    On windows the xsl library used has a bug which is preventing it from matching the document node (the parent of the root element of the document).
    I reduced this to a test case:
    xml data:
    <first>
      <second />
    </first>
    xsl stylesheet:
    <xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method='text'/>
      <xsl:template match='/'>ROOT<xsl:apply-templates/></xsl:template>
      <xsl:template match='first'>FIRST<xsl:apply-templates/></xsl:template>
      <xsl:template match='second'>SECOND<xsl:apply-templates/></xsl:template>
    </xsl:stylesheet>
    The output should be ROOTFIRSTSECOND and this is the observed output if this stylesheet is processed by msxsl or xsltproc. The problem is, when this is processed by LrXML on windows the output is FIRSTSECOND.
    Granted I am not an xsl expert but to the best of my knowledge this looks like a bug. Any chance this can be fixed?
    Cheers.

    I used process explorer and found that in my case Lightroom uses msxml3.dll. I also ran msxml.exe -u 3.0 which selects the same dll for processing and verified that msxml.exe gives different results that Lightroom.
    Here's the code I am running. In Info.lua:
      LrExportMenuItems = {
          title = 'Test XSLT',
          file = 'TestXSLT.lua'
    and in TestXSLT.lua:
    local logger = import('LrLogger')()
    logger:enable('logfile')
    local LrXml = import('LrXml')
    local utils = require('utils')
    local xml_data = [[
    <?xml version='1.0' encoding='UTF-8'?>
    <first>
      <second />
    </first>
    local xslt_data = [[
    <xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method='text'/>
      <xsl:template match='/'>ROOT<xsl:apply-templates/></xsl:template>
      <xsl:template match='first'>FIRST<xsl:apply-templates/></xsl:template>
      <xsl:template match='second'>SECOND<xsl:apply-templates/></xsl:template>
    </xsl:stylesheet>
    logger:debug('Parsing xml: ' .. xml_data)
    local xml = LrXml.parseXml(xml_data)
    logger:debug('Applying xslt: ' .. xslt_data)
    local res = xml:transform(xslt_data)
    logger:debug('Result: ' .. res)
    Can you please try and verify that it is broken for you as well?
    Thank you.
    Fixed code formatting. disht

Maybe you are looking for

  • Safari crashes everytime I open it

    Safari crashes every time I try to open it

  • How to install Oracle Pers Edit 8i on Windows Me

    Hi, i hope that sb would help on this: I can't install the Oracle Personal Edition 8i on my pc. When I run setup wizard, after the first <next> of the first 'screen', I return to my desktop's view. My system is an AMD processor at 400MHz with 98MB RA

  • Receiver file adapter command line

    hi, i am just wondering how to use command line on receiver file adapter. i am not clear how to use this. please modify on the following command! anyway, i have to call java application after put some files by receiver file adapter. cmd.exe %Fjava ./

  • Can you use boolean function in where clause

    Hi, I have a boolean function. Is it possible to use it in where clause of query. Eg; is_prime(13) returns boolean select 1 from dual where is_prime(13)

  • Compare Two Values in logic:equal issue !!!!!!!!!!!

    Hi Techie !!!! I have list object from DB inwhich i want compare a field in <logic:equal> Struts EL ....... I have written the following code..... <%          List list = (List)request.getAttribute("AppointmentDetailNavigationList");       pageContex