Appending a DocumentFragment to XMLDocument

I've been having a surprisingly difficult time trying to do this simple thing: append a DocumentFragment to an XMLDocument.
Here is my method; there are several print statements in here for debugging:
* This method joins two XML elements to form a single XML document: the individual
* SDI element, in an XMLDocument, and the non-SDI parts of the record, in a
* DocumentFragment. The method assumes that each element has just one child node
* containing the value. Also assumed is a class object, inputroot, which is a
* Node that is the root element of an XMLDocument.
private void joinSDI(XMLDocument sdidoc, DocumentFragment frag)
NodeList nonSdiNodeList = frag.getChildNodes();
Node tempRecRoot = sdidoc.getDocumentElement();
if (DEBUG3)
System.out.println("length of node list = "+nonSdiNodeList.getLength());
for (int i = 0; i < nonSdiNodeList.getLength(); i++)
System.out.println("iteration "+i);
Node node = nonSdiNodeList.item(i);
Node n = node.getFirstChild(); // this is the SDI
System.out.println("source name = " + node.getNodeName());
System.out.println("source value = " + n.getNodeValue());
Node tempNode = sdidoc.createTextNode(n.getNodeName());
tempNode.setNodeValue(n.getNodeValue());
System.out.println("new node type = " + tempNode.getNodeType());
System.out.println("new node name = " + tempNode.getNodeName());
System.out.println("new node value = " + tempNode.getNodeValue());
tempRecRoot.appendChild(tempNode);
// Now append this record XML doc to the insertion document we are building.
System.out.println("the constructed input doc:");
try {
sdidoc.print(System.out);
catch (IOException e)
System.out.println("Caught IO parse exception : "+e.getMessage());
this.inputroot.appendChild(sdidoc);
return;
Here is the input xml doc:
<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
<!DOCTYPE hydro SYSTEM "hydro.dtd">
<hydro>
<ROW num="1">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>14-APR-00 12:00:00</DATE_HOUR>
<VALUE>644.039978</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>Z</VALIDATION>
</ROW>
<ROW num="2">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>14-APR-00 13:00:00</DATE_HOUR>
<VALUE>111</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>Z</VALIDATION>
</ROW>
<ROW num="3">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>14-APR-00 14:00:00</DATE_HOUR>
<VALUE>333</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>Z</VALIDATION>
</ROW>
</hydro>
Here is what I get for output (including the debugging statements):
null

I've been having a surprisingly difficult time trying to do this simple thing: append a DocumentFragment to an XMLDocument.
Here is my method; there are several print statements in here for debugging:
* This method joins two XML elements to form a single XML document: the individual
* SDI element, in an XMLDocument, and the non-SDI parts of the record, in a
* DocumentFragment. The method assumes that each element has just one child node
* containing the value. Also assumed is a class object, inputroot, which is a
* Node that is the root element of an XMLDocument.
private void joinSDI(XMLDocument sdidoc, DocumentFragment frag)
NodeList nonSdiNodeList = frag.getChildNodes();
Node tempRecRoot = sdidoc.getDocumentElement();
if (DEBUG3)
System.out.println("length of node list = "+nonSdiNodeList.getLength());
for (int i = 0; i < nonSdiNodeList.getLength(); i++)
System.out.println("iteration "+i);
Node node = nonSdiNodeList.item(i);
Node n = node.getFirstChild(); // this is the SDI
System.out.println("source name = " + node.getNodeName());
System.out.println("source value = " + n.getNodeValue());
Node tempNode = sdidoc.createTextNode(n.getNodeName());
tempNode.setNodeValue(n.getNodeValue());
System.out.println("new node type = " + tempNode.getNodeType());
System.out.println("new node name = " + tempNode.getNodeName());
System.out.println("new node value = " + tempNode.getNodeValue());
tempRecRoot.appendChild(tempNode);
// Now append this record XML doc to the insertion document we are building.
System.out.println("the constructed input doc:");
try {
sdidoc.print(System.out);
catch (IOException e)
System.out.println("Caught IO parse exception : "+e.getMessage());
this.inputroot.appendChild(sdidoc);
return;
Here is the input xml doc:
<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
<!DOCTYPE hydro SYSTEM "hydro.dtd">
<hydro>
<ROW num="1">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>14-APR-00 12:00:00</DATE_HOUR>
<VALUE>644.039978</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>Z</VALIDATION>
</ROW>
<ROW num="2">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>14-APR-00 13:00:00</DATE_HOUR>
<VALUE>111</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>Z</VALIDATION>
</ROW>
<ROW num="3">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>14-APR-00 14:00:00</DATE_HOUR>
<VALUE>333</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>Z</VALIDATION>
</ROW>
</hydro>
Here is what I get for output (including the debugging statements):
null

Similar Messages

  • Appending a DocumentFragment to XMLDocument (acutal)

    (Sorry for previous incorrect post, which was incomplete; this is the correct post.)
    I've been having a surprisingly difficult time trying to do this simple thing: append a DocumentFragment to an XMLDocument.
    Here is my method; there are several print statements in here for debugging:
    * This method joins two XML elements to form a single XML document: the individual
    * SDI element, in an XMLDocument, and the non-SDI parts of the record, in a
    * DocumentFragment. The method assumes that each element has just one child node
    * containing the value. Also assumed is a class object, inputroot, which is a
    * Node that is the root element of an XMLDocument.
    private void joinSDI(XMLDocument sdidoc, DocumentFragment frag)
    NodeList nonSdiNodeList = frag.getChildNodes();
    Node tempRecRoot = sdidoc.getDocumentElement();
    if (DEBUG3)
    System.out.println("length of node list = "+nonSdiNodeList.getLength());
    for (int i = 0; i < nonSdiNodeList.getLength(); i++)
    System.out.println("iteration "+i);
    Node node = nonSdiNodeList.item(i);
    Node n = node.getFirstChild(); // this is the SDI
    System.out.println("source name = " + node.getNodeName());
    System.out.println("source value = " + n.getNodeValue());
    Node tempNode = sdidoc.createTextNode(n.getNodeName());
    tempNode.setNodeValue(n.getNodeValue());
    System.out.println("new node type = " + tempNode.getNodeType());
    System.out.println("new node name = " + tempNode.getNodeName());
    System.out.println("new node value = " + tempNode.getNodeValue());
    tempRecRoot.appendChild(tempNode);
    // Now append this record XML doc to the insertion document we are building.
    System.out.println("the constructed input doc:");
    try {
    sdidoc.print(System.out);
    catch (IOException e)
    System.out.println("Caught IO parse exception : "+e.getMessage());
    this.inputroot.appendChild(sdidoc);
    return;
    Here is the input xml doc:
    <?xml version="1.0" encoding="US-ASCII" standalone="no"?>
    <!DOCTYPE hydro SYSTEM "hydro.dtd">
    <hydro>
    <ROW num="1">
    <HM_SITE_CODE>HDMLC</HM_SITE_CODE>
    <HM_PCODE>TRACE</HM_PCODE>
    <DATE_HOUR>14-APR-00 12:00:00</DATE_HOUR>
    <VALUE>644.039978</VALUE>
    <SOURCE_ID>4</SOURCE_ID>
    <VALIDATION>Z</VALIDATION>
    </ROW>
    <ROW num="2">
    <HM_SITE_CODE>HDMLC</HM_SITE_CODE>
    <HM_PCODE>TRACE</HM_PCODE>
    <DATE_HOUR>14-APR-00 13:00:00</DATE_HOUR>
    <VALUE>111</VALUE>
    <SOURCE_ID>4</SOURCE_ID>
    <VALIDATION>Z</VALIDATION>
    </ROW>
    <ROW num="3">
    <HM_SITE_CODE>HDMLC</HM_SITE_CODE>
    <HM_PCODE>TRACE</HM_PCODE>
    <DATE_HOUR>14-APR-00 14:00:00</DATE_HOUR>
    <VALUE>333</VALUE>
    <SOURCE_ID>4</SOURCE_ID>
    <VALIDATION>Z</VALIDATION>
    </ROW>
    </hydro>
    Here is what I get for output (including the debugging statements):
    length of node list = 4
    iteration 0
    source name = DATE_HOUR
    source value = 14-APR-00 12:00:00
    new node type = 3
    new node name = #text
    new node value = 14-APR-00 12:00:00
    iteration 1
    source name = VALUE
    source value = 644.039978
    new node type = 3
    new node name = #text
    new node value = 644.039978
    iteration 2
    source name = SOURCE_ID
    source value = 4
    new node type = 3
    new node name = #text
    new node value = 4
    iteration 3
    source name = VALIDATION
    source value = Z
    new node type = 3
    new node name = #text
    new node value = Z
    the constructed input doc:
    <?xml version = '1.0'?>
    <ROWSET><ROW num="1"><SITE_DATATYPE_ID>2158</SITE_DATATYPE_ID></ROW>14-APR-00 12:00:00644.0399784Z</ROWSET>
    Exception in thread "main" java.lang.NullPointerException
    at Hdbdom.joinSDI(Compiled Code)
    at Hdbdom.addRec(Hdbdom.java:534)
    at Hdbdom.buildInsertQry(Compiled Code)
    at Hdbdom.parsedoc(Hdbdom.java:228)
    at Hdbdom.main(Hdbdom.java:695)
    I am puzzled by several things here:
    - why i s the node name #text in the new document?
    - why are my node values all jammed together in the output instead of becoming separate nodes?
    - how do I set the doctype in the output document?
    - why do I get a null pointer when attempting to append this output doc to the inputroot object?
    Any help would be much appreciated,
    --Rick Casey
    null

    package package2;
    import oracle.xml.parser.v2.*;
    import org.w3c.dom.*;
    import java.io.*;
    public class Class1
    public static void main(String [] a) throws Throwable {
    DOMParser d = new DOMParser();
    d.parse(new StringReader("<x><y/><z/></x>"));
    XMLDocument doc = d.getDocument();
    DocumentFragment frag = doc.createDocumentFragment();
    frag.appendChild(doc.createElement("extra-foo"));
    appendFrag(doc,frag);
    doc.print(System.out);
    public static void appendFrag(XMLDocument doc, DocumentFragment frag) {
    doc.getDocumentElement().appendChild(frag);
    }<HR></BLOCKQUOTE>
    Excellent! Thank you!
    That worked, except that the fragment gets appended after the trailing </ROW> tag.
    Here's an example of the incorrect append:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1"> <SITE_DATATYPE_ID>2158</SITE_DATATYPE_ID>
    </ROW>
    <DATE_HOUR>14-APR-00 12:00:00</DATE_HOUR>
    <VALUE>644.039978</VALUE>
    <SOURCE_ID>4</SOURCE_ID>
    <VALIDATION>Z</VALIDATION>
    </ROWSET>
    Is there an easy way to append such that my elements appear after the <SITE_DATATYPE_ID> element within the <ROW> tag?
    TIA!
    --Rick Caesy
    <HR></BLOCKQUOTE>
    Steve,
    Nevermind my previous question; I answered it myself -- for those interested, the (very easy) solution was:
    sdidoc.getDocumentElement().getFirstChild().appendChild(frag);
    --Rick Casey                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Generating XML String

    I may have missed something obvious but the SAX & DOM bits of
    the XML Parser don't seem to supply any way of getting from a
    set of parsed (or created) Document Java objects to a marked up
    XML string. Is this something we have to do ourselves by
    navigating through the node tree and adding the necessary
    markup? It seems generic enough to be provided by one of your
    APIs (such as the XSL bits?).
    Thanks,
    Dave
    null

    Thanks,
    I found the print method on the XMLDocument class which
    generates an encoded string from that XMLDocument. This is fine
    but what I had was a DocumentFragment reference returned from
    the XSLProcessor.
    I assume you have to get an XMLDocument from this
    DocumentFragment (since XMLDocument doesnt implement that
    interface) by creating an empty XMLDocument and then appending
    the DocumentFragment as a child element. You can then use the
    print method to get the XML string containing the styled XML.
    This seems to work ok. Is this the right way to go about it?
    Cheers,
    Dave
    Oracle XML Team wrote:
    : In oracle.xml.parser.NodeFactory you will find a
    createDocument
    : method which will create the document node to get your XML
    : document starter. This method was omitted in the DOM Level 1
    : Req but has been added for Level 2. We have implemented it in
    : both our v1 and v2 parsers.
    : Oracle XML Team
    : http://technet.oracle.com
    : Oracle Technology Network
    : Dave Barton (guest) wrote:
    : : I may have missed something obvious but the SAX & DOM bits
    of
    : : the XML Parser don't seem to supply any way of getting from
    a
    : : set of parsed (or created) Document Java objects to a marked
    : up
    : : XML string. Is this something we have to do ourselves by
    : : navigating through the node tree and adding the necessary
    : : markup? It seems generic enough to be provided by one of
    your
    : : APIs (such as the XSL bits?).
    : : Thanks,
    : : Dave
    null

  • in String Buffer

    I need to insert a < sign in a StringBuffer.
    I'm using the following code:
                            tmpStrBuf.insert(0, '<');
                            tmpStrBuf.insert(tmpStrBuf.length(), ">");While the > sign inserts correctly, for the < sign, I get
    & lt; (space inserted to prevent forum from parsing)
    Any help or suggestions appreciated.
    Thanks,
    Jim

    Good point...I added some more system.out.println to the code, the StringBuffer it not the problem.
    I'm actually building an xml string, from an existing string. I need to change part of the original string, add some items, and delete some of it.
    Then it is added to an ArrayList, then later on in the code, I step through the ArrayList, adding each item in the ArrayList to the XML document
    Code:
    tmpStrBuf.insert(0, "<");
    tmpStrBuf.insert(tmpStrBuf.length(), ">");
    ArrayList literalExLines = new ArrayList();
    literalExLines.add(tmpStrBuf.toString());
    // Create the literal example text node
    ltetext = question.createTextNode(literalExLines.get(n).toString()) ;
    // Add the text to the element
    lte.appendChild(ltetext);
    // Add the "<literalExample>" tag to "<stem>"
    stem.appendChild(lte);
    // Add the "<question>" tag to "<stem>"
    if (debug) System.out.println("Adding stem");
    qst.appendChild(stem);
    So, somewhere in appending it to the xmlDocument, it is getting converted.
    Any suggestions on where it might be getting converted?
    Thanks,
    Jim

  • XSLProcessor.Process throws  oracle.xml.xpath.XPathException:

    I have a java application which is parsing an XMLDocument using XMLProcessor.process(xsl,doc);
    It works for many XML messages, and their related XSL transformers, but throws this error regarding a dayTimeDuration() function.
    I'm using XDK version 10g, Java release:xdk_linux_10.2.0.2.0_production
    Other transformations without this function work fine. What am I doing wrong?
    Any help is appreciated.
    The Error is:
    oracle.xml.xpath.XPathException: Parse Error in dayTimeDuration function.
    The XML is:
    <SPLIMCreatedUpdatedOrder Destination="RTS">
         <HeaderData>
              <TransactionCode>3001</TransactionCode>
         </HeaderData>
         <TaskData>
              <FieldOrderNumber>TEST00001</FieldOrderNumber>
              <OrderStatus>Unassigned</OrderStatus>
              <DivisionName>Oregon</DivisionName>
              <DistrictName>Albany District</DistrictName>
              <CustomerName>Kathy Foote</CustomerName>
              <CustomerAddress1>105 CORCORAN LN</CustomerAddress1>
              <CustomerAddress2>Apt 101</CustomerAddress2>
              <CustomerCityState>CENTRAL POINT, OR</CustomerCityState>
              <CustomerZipCode>97502</CustomerZipCode>
              <OrderType>CON</OrderType>
              <TaskNumber>0</TaskNumber>
              <TaskDuration>10</TaskDuration>
              <TaskPriority>3</TaskPriority>
              <TaskExternalPriority></TaskExternalPriority>
              <Longitude>-122.923269</Longitude>
              <Latitude>42.370841</Latitude>
              <EnrouteDateTime></EnrouteDateTime>
              <OnsiteDateTime></OnsiteDateTime>
              <CompletionDateTime></CompletionDateTime>
              <PrimaryOrderNumber></PrimaryOrderNumber>
              <DatabaseAction>U</DatabaseAction>
              <ServiceAreaName>Serviceman - OR - 11256</ServiceAreaName>
              <DivisionCode>OR</DivisionCode>
              <DistrictCode>11256</DistrictCode>
              <ServiceAreaCode>SVC01</ServiceAreaCode>
              <CompletionStatusCode>O</CompletionStatusCode>
              <TrackingStatusCode>U</TrackingStatusCode>
         </TaskData>
         <SchedulingData>
              <EarlyStartDateTime>2007-01-17T08:00:00</EarlyStartDateTime>
              <DueOnDateTime>2007-01-31T17:00:00</DueOnDateTime>
              <ApptStartDateTime></ApptStartDateTime>
              <ApptFinishDateTime></ApptFinishDateTime>
              <TimeZone></TimeZone>
         </SchedulingData>
         <AssignmentData>
              <PreferredCrewName></PreferredCrewName>
              <RequiredCrewName></RequiredCrewName>
              <PrimaryFunction>Service</PrimaryFunction>
              <SkillData></SkillData>
              <CapabilityData></CapabilityData>
         </AssignmentData>
    </SPLIMCreatedUpdatedOrder>
    The XSL is:
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xdt="http://www.w3.org/2003/05/xpath-datatypes" xmlns:eg="local" xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
         <xsl:template match="SPLIMCreatedUpdatedOrder">
              <SOAP-ENV:Envelope
                   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                   xmlns:ns2="http://mwm.splwg.com/webservices/packets/"
                   xmlns:ns1="http://mwm.splwg.com/webservices/"
                   xmlns:ns3="http://mwm.splwg.com/webservices/methods/">
              <xsl:variable name="databaseAction">
                   <xsl:value-of select="TaskData/DatabaseAction"/>
              </xsl:variable>
              <xsl:choose>
                   <xsl:when test="$databaseAction='A'">
                        <NEW_STOP>
                             <NEW_STOP_DATA>
                                  <PLAN_STOP>
                                       <IDENT>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </IDENT>
                                       <STATUS>
                                            <xsl:value-of select="TaskData/OrderStatus"/>
                                       </STATUS>
                                       <STARTED_DATE>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,1,4)"/>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,6,2)"/>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,9,2)"/>
                                       </STARTED_DATE>
                                       <STARTED_TIME>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,12,2)"/>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,15,2)"/>
                                       </STARTED_TIME>
                                       <COMPLETION_DATE>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,1,4)"/>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,6,2)"/>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,9,2)"/>
                                       </COMPLETION_DATE>
                                       <COMPLETION_TIME>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,12,2)"/>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,15,2)"/>
                                       </COMPLETION_TIME>
                                  </PLAN_STOP>
                                  <STOP>
                                       <IDENT>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </IDENT>
                                       <INITIAL_STATUS>FREE</INITIAL_STATUS>
                                       <JOB_DELAY>
                                            <xsl:value-of select="xs:int(TaskData/TaskDuration) * 60"/>
                                       </JOB_DELAY>
                                       <R_MUSTHAVE>
                                            <xsl:for-each select="AssignmentData">
                                                 <xsl:for-each select="SkillData">
                                                      <xsl:value-of select="."/>,</xsl:for-each>
                                            </xsl:for-each>
                                       </R_MUSTHAVE>
                                       <LATITUDE>
                                            <xsl:value-of select="TaskData/Latitude"/>
                                       </LATITUDE>
                                       <LONGTITUDE>
                                            <xsl:value-of select="TaskData/Latitude"/>
                                       </LONGTITUDE>
                                       <PRIMARY_STOP_ID>
                                            <xsl:value-of select="TaskData/PrimaryOrderNumber"/>
                                       </PRIMARY_STOP_ID>
                                       <STREET_NO>
                                            <xsl:value-of select="substring-before(TaskData/CustomerAddress1,' ')"/>
                                       </STREET_NO>
                                       <STREET>
                                            <xsl:value-of select="substring-after(TaskData/CustomerAddress1,' ')"/>
                                       </STREET>
                                       <CITY>
                                            <xsl:value-of select="substring-before(TaskData/CustomerCityState,',')"/>
                                       </CITY>
                                       <STATE>
                                            <xsl:value-of select="substring-after(TaskData/CustomerCityState,',')"/>
                                       </STATE>
                                       <POSTCODE>
                                            <xsl:value-of select="TaskData/CustomerZipCode"/>
                                       </POSTCODE>
                                  </STOP>
                                  <STOP_TW>
                                       <IDENT>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </IDENT>
                                       <STOP>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </STOP>
                                       <xsl:if test="string-length(SchedulingData/ApptStartDateTime) > 0">
                                            <xsl:variable name="apptDuration">
                                                 <xsl:value-of select="xs:dayTimeDuration(xs:dateTime(SchedulingData/ApptFinishDateTime)-xs:dateTime(SchedulingData/ApptStartDateTime))"/>
                                            </xsl:variable>
                                            <START_DATE>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,1,4)"/>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,6,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,9,2)"/>
                                            </START_DATE>
                                            <START_TIME>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,12,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,15,2)"/>
                                            </START_TIME>
                                            <xsl:variable name="iTotalHours">
                                                 <xsl:value-of select="xs:int(days-from-duration($apptDuration) * 24 + hours-from-duration($apptDuration))"/>
                                            </xsl:variable>
                                            <xsl:variable name="iMinutes">
                                                 <xsl:value-of select="xs:int(minutes-from-duration($apptDuration))"/>
                                            </xsl:variable>
                                            <DURATION>
                                                 <xsl:if test="not ($iTotalHours > 99)">0</xsl:if>
                                                 <xsl:if test="not ($iTotalHours > 9)">0</xsl:if>
                                                 <xsl:value-of select="xs:string($iTotalHours)"/>
                                                 <xsl:if test="not ($iMinutes > 60)">0</xsl:if>
                                                 <xsl:value-of select="xs:string($iMinutes) "/>
                                            </DURATION>
                                       </xsl:if>
                                       <!---->
                                       <xsl:if test="string-length(SchedulingData/ApptStartDateTime) = 0">
                                            <xsl:variable name="apptDuration">
                                                 <xsl:value-of select="xs:dayTimeDuration(xs:dateTime(SchedulingData/DueOnDateTime) - xs:dateTime(SchedulingData/EarlyStartDateTime))"/>
                                            </xsl:variable>
                                            <START_DATE>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,1,4)"/>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,6,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,9,2)"/>
                                            </START_DATE>
                                            <START_TIME>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,12,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,15,2)"/>
                                            </START_TIME>
                                            <xsl:variable name="iTotalHours">
                                                 <xsl:value-of select="xs:int(days-from-duration($apptDuration) * 24 + hours-from-duration($apptDuration))"/>
                                            </xsl:variable>
                                            <xsl:variable name="iMinutes">
                                                 <xsl:value-of select="xs:int(minutes-from-duration($apptDuration))"/>
                                            </xsl:variable>
                                            <DURATION>
                                                 <xsl:if test="not ($iTotalHours > 99)">0</xsl:if>
                                                 <xsl:if test="not ($iTotalHours > 9)">0</xsl:if>
                                                 <xsl:value-of select="xs:string($iTotalHours)"/>
                                                 <xsl:if test="not ($iMinutes > 60)">0</xsl:if>
                                                 <xsl:value-of select="xs:string($iMinutes) "/>
                                            </DURATION>
                                       </xsl:if>
                                  </STOP_TW>
                             </NEW_STOP_DATA>
                        </NEW_STOP>
                   </xsl:when>
                   <xsl:when test="$databaseAction='U'">
                        <UPDATE_STOP>
                             <UPDATE_STOP_DATA>
                                  <PLAN_STOP>
                                       <IDENT>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </IDENT>
                                       <STOP>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </STOP>
                                       <STATUS>
                                            <xsl:value-of select="TaskData/OrderStatus"/>
                                       </STATUS>
                                       <STARTED_DATE>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,1,4)"/>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,6,2)"/>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,9,2)"/>
                                       </STARTED_DATE>
                                       <STARTED_TIME>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,12,2)"/>
                                            <xsl:value-of select="substring(TaskData/OnsiteDateTime,15,2)"/>
                                       </STARTED_TIME>
                                       <COMPLETION_DATE>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,1,4)"/>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,6,2)"/>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,9,2)"/>
                                       </COMPLETION_DATE>
                                       <COMPLETION_TIME>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,12,2)"/>
                                            <xsl:value-of select="substring(TaskData/CompletionDateTime,15,2)"/>
                                       </COMPLETION_TIME>
                                  </PLAN_STOP>
                                  <STOP>
                                       <IDENT>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </IDENT>
                                       <INITIAL_STATUS>FREE</INITIAL_STATUS>
                                       <JOB_DELAY>
                                            <xsl:value-of select="xs:int(TaskData/TaskDuration) * 60"/>
                                       </JOB_DELAY>
                                       <R_MUSTHAVE>
                                            <xsl:for-each select="AssignmentData">
                                                 <xsl:for-each select="SkillData">
                                                      <xsl:value-of select="."/>,</xsl:for-each>
                                            </xsl:for-each>
                                       </R_MUSTHAVE>
                                       <LATITUDE>
                                            <xsl:value-of select="TaskData/Latitude"/>
                                       </LATITUDE>
                                       <LONGTITUDE>
                                            <xsl:value-of select="TaskData/Latitude"/>
                                       </LONGTITUDE>
                                       <PRIMARY_STOP_ID>
                                            <xsl:value-of select="TaskData/PrimaryOrderNumber"/>
                                       </PRIMARY_STOP_ID>
                                       <STREET_NO>
                                            <xsl:value-of select="substring-before(TaskData/CustomerAddress1,' ')"/>
                                       </STREET_NO>
                                       <STREET>
                                            <xsl:value-of select="substring-after(TaskData/CustomerAddress1,' ')"/>
                                       </STREET>
                                       <CITY>
                                            <xsl:value-of select="substring-before(TaskData/CustomerCityState,',')"/>
                                       </CITY>
                                       <STATE>
                                            <xsl:value-of select="substring-after(TaskData/CustomerCityState,',')"/>
                                       </STATE>
                                       <POSTCODE>
                                            <xsl:value-of select="TaskData/CustomerZipCode"/>
                                       </POSTCODE>
                                  </STOP>
                                  <STOP_TW>
                                       <IDENT>
                                            <xsl:value-of select="TaskData/FieldOrderNumber"/>
                                       </IDENT>
                                       <xsl:if test="string-length(SchedulingData/ApptStartDateTime) > 0">
                                            <xsl:variable name="apptDuration">
                                                 <xsl:value-of select="xs:dayTimeDuration(xs:dateTime(SchedulingData/ApptFinishDateTime)-xs:dateTime(SchedulingData/ApptStartDateTime))"/>
                                            </xsl:variable>
                                            <START_DATE>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,1,4)"/>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,6,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,9,2)"/>
                                            </START_DATE>
                                            <START_TIME>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,12,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/ApptStartDateTime,15,2)"/>
                                            </START_TIME>
                                            <DURATION>
                                                 <xsl:if test="not (xs:hours-from-duration($apptDuration) > 99)">0</xsl:if>
                                                 <xsl:if test="not (xs:hours-from-duration($apptDuration) > 9)">0</xsl:if>
                                                 <xsl:value-of select="xs:hours-from-duration($apptDuration)"/>
                                                 <xsl:if test="not (xs:minutes-from-duration($apptDuration) > 9)">0</xsl:if>
                                                 <xsl:value-of select="xs:minutes-from-duration($apptDuration)"/>
                                            </DURATION>
                                       </xsl:if>
                                       <!---->
                                       <xsl:if test="string-length(SchedulingData/ApptStartDateTime) = 0">
                                            <xsl:variable name="apptDuration">
                                                 <xsl:value-of select="xs:dayTimeDuration(xs:dateTime(SchedulingData/DueOnDateTime) - xs:dateTime(SchedulingData/EarlyStartDateTime))"/>
                                            </xsl:variable>
                                            <START_DATE>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,1,4)"/>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,6,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,9,2)"/>
                                            </START_DATE>
                                            <START_TIME>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,12,2)"/>
                                                 <xsl:value-of select="substring(SchedulingData/EarlyStartDateTime,15,2)"/>
                                            </START_TIME>
                                            <xsl:variable name="iTotalHours">
                                                 <xsl:value-of select="xs:int(days-from-duration($apptDuration) * 24 + hours-from-duration($apptDuration))"/>
                                            </xsl:variable>
                                            <xsl:variable name="iMinutes">
                                                 <xsl:value-of select="xs:int(minutes-from-duration($apptDuration))"/>
                                            </xsl:variable>
                                            <DURATION>
                                                 <!-- Add leading zeros -->
                                                 <xsl:if test="not ($iTotalHours > 99)">0</xsl:if>
                                                 <xsl:if test="not ($iTotalHours > 9)">0</xsl:if>
                                                 <xsl:value-of select="xs:string($iTotalHours)"/>
                                                 <xsl:if test="not ($iMinutes > 60)">0</xsl:if>
                                                 <xsl:value-of select="xs:string($iMinutes) "/>
                                            </DURATION>
                                       </xsl:if>
                                  </STOP_TW>
                             </UPDATE_STOP_DATA>
                        </UPDATE_STOP>
                   </xsl:when>
              </xsl:choose>
              </SOAP-ENV:Envelope>
         </xsl:template>
    </xsl:stylesheet>

    The code is appended:
    public XMLElement TransformDoc(XMLDocument doc, String xslFile){
         DOMParser           parser;
         XMLDocument      xsldoc;
         URL                xslURL;
         try {
         // Parse xsl and xml documents
         xsldoc = new XMLDocument();
         parser = new DOMParser();
         // Parse the XSL file
         xslURL = createURL(xslFile);
         parser.parse(xslURL);
         xsldoc = parser.getDocument();
         // Instantiate a stylesheet
         XSLProcessor processor = new XSLProcessor();
         processor.setBaseURL(xslURL);
         XSLStylesheet xsl = processor.newXSLStylesheet(xsldoc);
         // Display any warnings that may occur
         processor.showWarnings(true);
         processor.setErrorStream(System.err);
         XMLDocumentFragment result = processor.processXSL(xsl, doc);

  • Document vs. DocumentFragment

    What is the best practice for generating fully-functional XMLDocuments from transforms using XSLProcessor? Most of the processXSL() methods generate DocumentFragments. Why? Sometimes when I append a node from a DocumentFragment to a new XMLDocument (using importNode() or adoptNode()), subsequent xpath operations performed on that XMLDocument won't work or won't produce any nodes.
    Also, if I use XMLQuery.setXSLT() and then call getXMLDOM(), I won't get the entire document. Why is this (when if I call getXMLString() and parse the resulting String, my Document will always be complete)?
    Also, how can I "Oraclize" an Document using a different DOMImplementation. I can serialize the foreign Document and re-parse it using Oracle's DOMParser, but that seems to defeat the whole concept of using the Document interface in the first place: what's the best practice for using Document objects with different DOMImplementations with Oracle code?
    Thanks!

    processXSL can either return a DocumentFragment or write the result to a PrintWriter/OutputStream.
    It returns DocumentFragment because of section 3.1 in the XSLT 1.0 specification:
    "it is possible that a result tree will not be a well-formed XML document;...When the source tree is created in some other way, for example by using the DOM, the usual restrictions are relaxed for the source tree as for the result tree."
    This means that you can legally write a transform that produces the result:
    <foo/>
    <foo/>
    <foo/>
    which is a list of elements, but not a legal XML document (which would require a single outermost element. DocumentFragment is the only DOM object that allows an arbitrary sequence of DOM nodes that XSLT can produce.
    If subsequent xpath operations don't work after successfully appending child nodes to a tree, then that is a bug. Try the latest XDK 9.0.2 Beta which fixes some bugs in that area, and if you still have a problem, report it with a simple testcase here in the forum.
    Need to understand more about your XMLQuery.setXSLT() issue and what part of the document is "left out".
    You cannot "Oracleize" an org.w3c.dom.Document whose concrete class was created with a different DOMImplementation. We don't support the ability to transform from an arbitrary Document interface for performance reasons. This keeps our XSLT engine very fast. You'll find that engines that accept an arbitrary DOM are never as fast as when they can use their own internal structures.
    You can serialize and parse like you've suggested, or tree-walk and fire SAX events as another approach.

  • Adding an XMLDocument as a child to another Element

    Hello everyone,
    I am trying to add an XMLDocument as a child to an existing
    element. Here's an example:
    import org.w3c.dom.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import oracle.xml.parser.v2.*;
    public class ggg {
    public static void main (String [] args) throws Exception
    new ggg().doWork();
    public void doWork() throws Exception {
    XMLDocument doc1 = new XMLDocument();
    Element root1=doc1.createElement("root1");
    XMLDocument doc2= new XMLDocument();
    Element root2=doc2.createElement("root2");
    root1.appendChild(root2);
    doc1.print(System.out);
    This reports:
    D:\Temp\Oracle\sample>c:\jdk1.2.2\bin\javac -classpath
    D:\Temp\Oracle\lib\xmlpar
    serv2.jar;. ggg.java
    D:\Temp\Oracle\sample>c:\jdk1.2.2\bin\java -classpath
    D:\Temp\Oracle\lib\xmlpars
    erv2.jar;. ggg
    Exception in thread "main" java.lang.NullPointerException
    at
    oracle.xml.parser.v2.XMLDOMException.<init>(XMLDOMException.java:
    67)
    at
    oracle.xml.parser.v2.XMLNode.checkDocument(XMLNode.java:919)
    at oracle.xml.parser.v2.XMLNode.appendChild(XMLNode.java,
    Compiled Code)
    at
    oracle.xml.parser.v2.XMLNode.appendChild(XMLNode.java:494)
    at ggg.doWork(ggg.java:20)
    at ggg.main(ggg.java:12)
    Ideas?
    Razvan
    null

    Paul FitzPatrick (guest) wrote:
    : Oracle XML Team wrote:
    : : Razvan Dragomirescu (guest) wrote:
    : : : Hello everyone,
    : : : I am trying to add an XMLDocument as a child to an existing
    : : : element. Here's an example:
    : : : import org.w3c.dom.*;
    : : : import java.util.*;
    : : : import java.io.*;
    : : : import java.net.*;
    : : : import oracle.xml.parser.v2.*;
    : : : public class ggg {
    : : : public static void main (String [] args) throws
    : : Exception
    : : : new ggg().doWork();
    : : : public void doWork() throws Exception {
    : : : XMLDocument doc1 = new XMLDocument();
    : : : Element root1=doc1.createElement("root1");
    : : : XMLDocument doc2= new XMLDocument();
    : : : Element root2=doc2.createElement("root2");
    : : : root1.appendChild(root2);
    : : : doc1.print(System.out);
    : : : This reports:
    : : : D:\Temp\Oracle\sample>c:\jdk1.2.2\bin\javac -classpath
    : : : D:\Temp\Oracle\lib\xmlpar
    : : : serv2.jar;. ggg.java
    : : : D:\Temp\Oracle\sample>c:\jdk1.2.2\bin\java -classpath
    : : : D:\Temp\Oracle\lib\xmlpars
    : : : erv2.jar;. ggg
    : : : Exception in thread "main" java.lang.NullPointerException
    : : : at
    : : : oracle.xml.parser.v2.XMLDOMException.<init>
    : : (XMLDOMException.java:
    : : : 67)
    : : : at
    oracle.xml.parser.v2.XMLNode.checkDocument(XMLNode.java:919)
    : : : at oracle.xml.parser.v2.XMLNode.appendChild
    : : (XMLNode.java,
    : : : Compiled Code)
    : : : at
    : : : oracle.xml.parser.v2.XMLNode.appendChild(XMLNode.java:494)
    : : : at ggg.doWork(ggg.java:20)
    : : : at ggg.main(ggg.java:12)
    : : : Ideas?
    : : : Razvan
    : : You need to use the DocumentFragment class to do this as a
    : : document cannot have more than one root.
    : : Oracle XML Team
    : : http://technet.oracle.com
    : : Oracle Technology Network
    : Actually, isn't this specifically a problem with appending a
    node
    : created in another document, since all nodes contain a
    reference
    : to the document they are created in? While DocumentFragment
    : solves this, it isn't a more than one root problem, is it?
    BTW,
    : is there a quick/easy way to convert com.w3c.dom.Document to
    : com.w3c.dom.DocumentFragment?
    Oops, make that org.w3c . . .
    null

  • Trouble copying cloning XMLDocument

    I'm trying to create a copy of an XMLDocument called docA by taking a clone of it's document node and appending it to a second XMLDocument called docB.
    this statement
    XMLDocument docA= new XMLDocument();
    docB.appendChild(docA.cloneNode(true));
    throws an exception:
    oracle.xml.parser.v2.XMLDOMException: Node of this type cannot be added.
    I tried creating a root element in xslDocCopy first, but I still go the error.
    I don't quite understand the problem and couldn't find any documentation on the error. Are there restrictions on a document node? Is there a way to turn it into a DocumentFragment first and add that?
    Any help is greatly appreciated.
    Thank You.
    null

    sorry. that was full of errors. Here:
    I'm trying to create a copy of an XMLDocument called docA by taking a clone of it's document node and appending it to a second XMLDocument called docB.
    this statement
    XMLDocument docA= new XMLDocument();
    docB.appendChild(docA.cloneNode(true));
    throws an exception:
    oracle.xml.parser.v2.XMLDOMException: Node of this type cannot be added.
    I tried creating a root element in docB first, but I still get the same error.
    I don't quite understand the problem and couldn't find any documentation on the Exception. Are there restrictions on a document node? Is there a way to turn it into a DocumentFragment first and add that?
    Any help is greatly appreciated.
    Thank You.
    null

  • How to save a DocumentFragment which is not in XML

    Hi,
    i want to make an export from a view object as CSV-file. To achieve this i have made a stylesheet, that converts a xml to a text format.
    DocumentFragment oDF = tNode.transformNode(xslt);
    And from here i have the problem: How could i save the DocumentFragment to my harddisk? (Inserting that DocumentFragment in a XMLDocument doesn't work because it is no longer in xml-format)
    Thanx,
    Marc

    Hey Marc,
    I'd rather use a code like this:
    DOMParser parser = new DOMParser();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    try
    String xslUrl = "yourXSLdocument.xsl";
    parser.parse(is); // the xml document input stream
    XMLDocument doc = parser.getDocument();
    XSLProcessor xp = new XSLProcessor();
    try
    XSLStylesheet xsl = xp.newXSLStylesheet(new FileInputStream(xslUrl));
    xp.processXSL(xsl, doc, pw);
    String processedDoc = baos.toString();
    System.out.println(processedDoc); // Here you go!
    catch (XSLException xsle)
    JOptionPane.showMessageDialog(null, xsle.toString(), "XSLException", JOptionPane.ERROR_MESSAGE);
    catch (SAXException saxe)
    JOptionPane.showMessageDialog(null, saxe.toString(), "SAXException", JOptionPane.ERROR_MESSAGE);
    Please tell me is this is addressing your problem...
    Thank you

  • Appending node using Fuego API

    Following the example in the samples directory i wanted to create a XML node called "D" and append it to the node BB in the XML document below
    Final result = "<AAA><BB><C>blah</C><D>blah blah</D></BB></AAA>";
    -----CODE START-----
    String xmlstr = "<AAA><BB><C>blah</C></BB></AAA>";
    XMLDocument xmlDoc = XMLDocument();
    xmlDoc.initialize(content : xmlstr);
    XMLNode rootNode = xmlDoc.rootFor();
    XMLNode xmlNode1 = xmlDoc.createXMLNodeFor(tag : "D");
    XMLNode xmlNode2 = xmlNode1.appendTo(xmlNode : rootNode);
    String xmlContent = xmlDoc.print();
    display(xmlContent);
    -----CODE END-----
    I have to append it to the node BB but i dont know how to proceed furthur. Can anyone suggest a solution? Thanks for your help. Another question - with the above lines of code i get a blank?

    Finally figured it out - very wierd structure...
    String xmlstr = "<AAA><BB><C>blah</C></BB></AAA>";
    XMLDocument xmlDoc = XMLDocument();
    xmlDoc.initialize(content : xmlstr);
    XMLNode rootNode = xmlDoc.rootFor();
    XMLNode bbNode = rootNode.getChildFrom(path : "BB");
    XMLNode xmlNode2 = xmlDoc.createXMLNodeFor(tag : "D");
    xmlNode2.text = "blah blah";
    XMLNode xmlNode4 = bbNode.appendTo(xmlNode : xmlNode2);
    String xmlContent = xmlDoc.print();          
    display(xmlContent);
    The code mentioned above will append a new tag called D to BB.

  • Report Generation tool kit for MS office (Opening an existing excel file and appending to the bottom)

    I don't have any problems creating and filling an excel sheet with data. I use the New Report.vi, Easy Title.vi, and Easy Text.vi to create the file. I then save and dispose properly.
    What I don't seem to be able to do is open the exsting file and append data to the end of the sheet.
    Thanks in advance for your help.
    todd

    Hi Todd,
    You can do this by creating a new Excel report with the existing excel file path wired to the "template" input. Then use "Excel Get Last Row.vi" (located under Report Generation\Excel Specific\Excel General) to obtain the location of the last row. Then use that location to input new data into the file.
    Hope this helps,
    Dan

  • Append table - Regenerating a maintenance view

    People,
    I would like to create one more fied in a standard table, so I will create an append in this table.
    But it has a maintenance view associated to it. As this is a standard table, is there a way to regenerate this maintenance including the new field ?
    Thanks a lot!

    I´m not sure the maintenance view is regenerated.
    This is a standard table and I don´t want to get an access key to solve this.
    Anyone here has this experience?

  • Appending and add time stamp at a time........

    Hi all,
    i am working on a scenario...
    it is file based..no mapping and bpm can be used.
    I need to pick up file through xi and append it and put in the target with time stamp to it.
    we can achieve this if mapping or bpm is allowed.....
    But,in file processing we can use only one option at a time.....
    I found a way:
    scenario one: files will be appened and kept in a temparory folder
    using another scenario we will pick up the appeneded file and add time stamp and keep in target structure...
    but i dont think this is advisable...
    please suggest me any other ways to achieve this...(can run operating system command be helpfull??)
    thanks in advance..
    Regards,
    Kiran.

    HI,
    Yes you are right, Appending and adding Time Stamp will not be possible simultaneously.
    Refer - this could help you
    Dynamic Filename with TimeStamp  
    Dynamic Filename with TimeStamp
    /people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
    But some how you have to use mapping for it. Then if its allowed to use the mapping then as you have suggested, should have to go for two scenarios. No alternative,
    Probably also you can try with Customized Adapter Module for this.
    Thanks
    swarup

  • XSLT Mapping: Problem in appending xmlns attribute

    Hi
    This is my source message
    <?xml version="1.0" encoding="UTF-8"?>
    <soap-env:Envelope xmlns:soap-env= "http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Body>
    <OrderID xmlns="http://dummyvalue">12345</OrderID>
    </soap-env:Body>
    My XSLT mapping
    <?xml version='1.0' ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
    <xsl:template match="/">
    <soap-env:Envelope>
    <soap-env:Body>
    <OrderID>
    <xsl:attribute name = "xmlns" >
    <xsl:value-of select="@xmlns"/>
    </xsl:attribute>
    <xsl:text>12345</xsl:text>
    </OrderID>
    </soap-env:Body>
    </soap-env:Envelope>
    </xsl:template>
    </xsl:stylesheet>
    I am getting the error message as
    ERROR: Description: The value of the 'name' attribute may not be 'xmlns'.
    Please help me how to append xmlns attribute in OrderID element ??

    Hi,
    Use <xsl:element> to create a node in the output and specify the namespace.
    <xsl:element
    name="name"
    namespace="URI"
    use-attribute-sets="namelist">  <!-- Content:template --></xsl:element>
    Thanks,
    Beena.

  • Append worksheet from second document with NJAWIN

    Hi,
    I hope somebody can give me a hint joining two excel documents.
    I get following macro when I append the second document as object from filename in Excel:
    Sub Makro1()
    Sheets.Add
    Sheets("Tabelle1").Select
    Workbooks.Open Filename:="C:\exceltest.xls"
    ActiveWindow.Visible = False
    ActiveSheet.OLEObjects.Add(Filename:="C:\exceltest.xls", Link _
    :=False, DisplayAsIcon:=False).Select
    End Sub
    My java code looks like this:
    app.getWorkbooks()._Open(filename1, Boolean.FALSE, Boolean.FALSE);
    DispatchPtr ptr = app.getWorksheets().Add();
    ptr.invoke("Select");
    app.getWorkbooks()._Open(filename2, Boolean.FALSE, Boolean.FALSE);
    Now I get two instances from Excel, instead of appending it.
    How could I get these OLEObjects as shown in Macro?
    Thanks in advance
    rumpi

    Hmm, nobody has answered. I have done this before months. So if smb has the same problem
    my function looks smth like this. I'm glad to hear constructive critic:
    _Workbook wb2append = null;
    try {
    File f = new File(file2append);
    if (!f.exists())
    throw new IOException("File "+file2append+" does not exists!");
    String file2appendName = f.getName();
    wb2append = openXLS(file2append, Boolean.TRUE);
    * Activate first worksheet in workbook
    Worksheet sheetfirst = new _Worksheet(application.getSheets().getItem(new Integer(1)));
    sheet_first.Activate();
    * Rename all worksheets with prefix the filename of this workbook
    if (appendPrefix)
    renameSheetsWithPrefix(wb2append, file2appendName);
    * Copy all worksheets in this workbook after the activated
    * (last) worksheet in the target workbook.
    wb2append.getWorksheets().Select();
    wb2append.getWorksheets().Copy(null, wb_target.getSheets().getItem(new Integer(wb_target.getSheets().getCount())));
    wb2append.Close(Boolean.FALSE);

Maybe you are looking for