Reading XML element attribute

I use JSTL to read a remote XML but can only print the content of the elements. How do i print the content of the attributes?
<root><person id="1">George</person></root>
For example, to read the Person's name i use:
<x:out select="$xmloutput/ROOT/person"/>
But how do i print the ID value of the element?
Thanks in advance.

Already found the answer:
<x:out select="@attribute_name" />
Just add the @ sign

Similar Messages

  • Pixel-Positions in XML-Element attributes

    hi,
    is there a way, when attaching a xml-tag to e.g. a picture, that the top and left pixel value is saved in a xml-element attribute? the pixel value from top and from the left.
    thanks in advance.
    regards.

    hi,
    is there a way, when attaching a xml-tag to e.g. a picture, that the top and left pixel value is saved in a xml-element attribute? the pixel value from top and from the left.
    thanks in advance.
    regards.

  • Reading xml element outside onLoad method

    i want to read xml element outside onLoad method but i m unable to read can u plz give idea to solve this problem.................i m using this code..
    var linkData:XML = new XML();
    var linkXData:XMLNode;
    var serverName:XMLNode;
    var projectName:XMLNode;
    linkData.ignoreWhite = true;
    linkData.load("server.xml");
    linkData.onLoad = function(success:Boolean)
    if(success)
      trace("Link data loaded");
      serverName = linkData.firstChild.childNodes[0].firstChild;
      projectName = linkData.firstChild.childNodes[1].firstChild;
      linkXData = linkData.firstChild;
      trace("in success"+linkXData.childNodes.length)
    else
      trace("Failed to load link data");
    trace("ServerName="+ServerName)
    trace("projectName ="+projectName )
    this is giving ServerName=undefined
                        projectName =undefined
    my xml is
    <?xml version='1.0' encoding='UTF-8'?>
    <data>
    <servername>hyddtl900411</servername>
    <projectname>CCBCPC</projectname>
    </data>

    hi
    i am trying like that..............in that i want 2 use servername and projectname in navigation bar but sometimes it is working somtimes it is not working......
    i think due to loading of xml.can u give me some idea so that i can use that variable after loading of xml.
    var linkData:XML = new XML();
    var linkXData:XMLNode;
    var serverName:XMLNode;
    var projectName:XMLNode;
    var a;
    var b;
    linkData.ignoreWhite = true;
    linkData.load("server.xml");
    linkData.onLoad = function(success:Boolean)
    if(success)
      trace("Link data loaded");
      serverName = linkData.firstChild.childNodes[0].firstChild;
      projectName = linkData.firstChild.childNodes[1].firstChild;
      linkXData = linkData.firstChild;
      trace("in success"+linkXData.childNodes.length)
    else
      trace("Failed to load link data");
    id=setInterval(testvalue,1000);
    function testvalue():Void{
    a=serverName;
    b=projectName;
         trace("ServerName outside="+serverName)
         trace("projectName outside ="+projectName )
    setserver(serverName);
    clearInterval(id);
      var val;
    function setserver(val){
    trace("val="+val)
    init1(val);
    in init1() function...................................
    function init1(val){
    trace("val in init1="+val)
    trace("///////////////////////init1//////////////////////")
    trace("ServerName in init1="+serverName)
    trace("projectName in init1 ="+projectName )
    /*var localhost="hyddtl900411";
    var projectName="CCBCPC";*/
    var localhost=val;
    var projectName="CCBCPC";
    trace("localhost="+localhost)
    var links:Array = new Array();
    trace("link="+links[0])
    links[0] = "http://"+localhost+":8080/"+projectName+"/web/productOverview.html";
    links[1] = "http://"+localhost+":8080/"+projectName+"/web/Training.html";
    links[2] = "http://"+localhost+":8080/"+projectName+"/web/a.html";
    links[3] = "http://"+localhost+":8080/"+projectName+"/web/Case_studies.html";
    links[4] = "http://"+localhost+":8080/"+projectName+"/web/Team.html";
    links[5] = "http://"+localhost+":8080/"+projectName+"/web/offering.html";
    for(var i:Number = 0; i < links.length; i++)
    this["btn_" + i].pageRef = links[i];
    this["btn_" + i].onPress = function()
      getURL(this.pageRef);
    //highlight current button
    if(_root.activeBtn != undefined)
    this["btn_" + _root.activeBtn].enabled = false;
    this["btn_" + _root.activeBtn].useHandCursor = false;
    this["btn_" + _root.activeBtn].gotoAndStop(4);

  • JS: how can find role in XML element attribute

    Dear All,
    We could gather "footnote" XML elements as an array. But we need to filter the elements which has "role=endnote" in the attributes from the group of common footnote tagged elements .
    Eg. <footnote xml:id="en2" label="2" role="endnote"> from myGetXMLElements("//footnote")
    Kindly assist to get footnote XML elements which has the role "endnote".
    regards
    Masthan

    Hi Fred,
    Yes, I got it. Thanks
    regards
    Masthan

  • XML Gateway Mapping of XML Element Attribute

    Hi:
    If an inbound XML message contains this tag:
    <STATUS CODE="100"></STATUS>
    is it possible to map the CODE attribute to a database column?
    I've been attempting to do this but I'm receiving this error: Element STATUS not complete, expected elements ''.
    Thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I'll answer my own question here.  Found the section in the XML User Guide about mapping HTTP Error Responses (chapter 22 in the v6.1 pdf) and realized that the XML gateway had preconfigured settings to handle various error conditions.  Edited the error handling configuration for the specific Handler (rather than the global setting) and checked the box to allow the error to pass through the XML gateway.  Redeployed the subpolicy.

  • XML element attributes in program

    I am using following FMs to create XML document from internal table
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    My internal table has field 'AMT' and generated XML file has following line
    <AMT>1000</AMT>
    But I want this line to be generated as <AMT Ccy = 'USD'>1000</AMT>
    I tried to use set_attribute method of element but not able to get this.I should be missing somethig as I am new to this XML.
    Can anyone please advsie how I can get this?
    Thanks for your help.
    Srinivas

    Hello Srinivas
    Below you see sample coding that I use on SAP-PI to map attributes into the XML stream (INVOIC IDoc)::
    NOTE: mo_document is of TYPE REF TO if_ixml_document (which is exported as DATA_AS_DOM by fm SDIXML_DATA_TO_DOM).
    METHOD MAP_SD_DOC_CAT_AND_BILL_TYPE.
    * define local data
      DATA: ld_billingdoc         TYPE bapivbrkout-billingdoc,
            ld_billing_type       type bapivbrkout-bill_type,
            ld_sd_doc_category    TYPE vbtyp,
            ld_edi_qualifier      TYPE string.
      " Location code mapping only for outbound invoices, i.e.
      " invoices sent by subsidiary to its customers
      CHECK ( is_outbound_invoic( ) = abap_true ).
      CALL METHOD zcl_edi_idoc_invoic_services=>get_billingdoc_detail
        EXPORTING
          param              = mif_param
    *      id_idocnumber      =
          id_rfc_destination = md_rfcdest
        IMPORTING
          ed_billingdoc      = ld_billingdoc
          ed_billing_type    = ld_billing_type
          ed_sd_doc_category = ld_sd_doc_category
          ed_edi_qualifier   = ld_edi_qualifier.
    * NOTE: We add the SD document category and the EDI qualifier
    *       as attributes to E1EDK01/BELNR.
    **  <E1EDK01 SEGMENT="1">
    **      <CURCY>EUR</CURCY>
    **      <HWAER>EUR</HWAER>
    **      <WKURS>1.00000</WKURS>
    **      <ZTERM>T60F</ZTERM>
    **      <EIGENUINR>nnn</EIGENUINR>
    **      <BSART>INVO</BSART>
    **      <BELNR SD_DOC_CATEGORY="O" EDI_QUALIFIER="381" BILL_TYPE="ZOII">
    **        1010010911
    **      </BELNR>
    **      <NTGEW>97.662</NTGEW>
    **      <BRGEW>127.239</BRGEW>
    **      <GEWEI>KGM</GEWEI>
    **      <FKART_RL>LR</FKART_RL>
    **      <RECIPNT_NO>0000823305</RECIPNT_NO>
    **      <FKTYP>L</FKTYP>
    **  </E1EDK01>
      DATA: ld_name       TYPE string,
            ld_value      TYPE string,
            ld_rc         TYPE i,
            lo_node       TYPE REF TO if_ixml_node,
            lo_node_child TYPE REF TO if_ixml_node,
            lo_clone      TYPE REF TO if_ixml_node,
            lo_children   TYPE REF TO if_ixml_node_list,
            lo_element    TYPE REF TO if_ixml_element,
            lo_attribute  TYPE REF TO if_ixml_attribute,
            lo_filter     TYPE REF TO if_ixml_node_filter,
            lo_iter       TYPE REF TO if_ixml_node_iterator,
            lo_doc        TYPE REF TO if_ixml_document.
    * Filter for nodes of segment E1EDK01
      lo_filter = mo_document->create_filter_name( name = 'E1EDK01' ).
      CALL METHOD mo_document->create_iterator_filtered
        EXPORTING
    *      depth  = 0
          filter = lo_filter
        RECEIVING
          rval   = lo_iter.
      DO.
        lo_node = lo_iter->get_next( ).
        EXIT.
      ENDDO.
    * NODE: First (and single) parent node is the entire E1EDK01 segment
      lo_children = lo_node->get_children( ).
      lo_filter = mo_document->create_filter_name( name = 'BELNR' ).
      lo_iter = lo_children->create_iterator_filtered( lo_filter ).
    * NOTE: We should have a single child node => BELNR
      DO.
        lo_node = lo_iter->get_next( ).
        EXIT.
      ENDDO.
      CHECK ( lo_node IS BOUND ).
      ld_name  = lo_node->get_name( ).
      ld_value = lo_node->get_value( ).
      LOG-POINT ID zedi
                      SUBKEY mc_subkey_runtime
                      FIELDS syst-index ld_name ld_value.
    * Add attribute SD_DOC_CATEGORY and EDI_QUALIFIER to element BELNR
      lo_element ?= lo_node.
      ld_name  = 'SD_DOC_CATEGORY'.
      ld_value = ld_sd_doc_category.
      CALL METHOD lo_element->set_attribute
        EXPORTING
          name  = ld_name
          value = ld_value
        RECEIVING
          rval  = ld_rc.
      ld_name  = 'EDI_QUALIFIER'.
      ld_value = ld_edi_qualifier.
      CALL METHOD lo_element->set_attribute
        EXPORTING
          name  = ld_name
          value = ld_value
        RECEIVING
          rval  = ld_rc.
      ld_name  = 'BILL_TYPE'.
      ld_value = ld_billing_type.
      CALL METHOD lo_element->set_attribute
        EXPORTING
          name  = ld_name
          value = ld_value
        RECEIVING
          rval  = ld_rc.
    ENDMETHOD.
    Regards
      Uwe

  • Parse XML Elements/Attributes from CLOB into Oracle Table

    Hi!
    I have an XML file (loaded into a CLOB) which I need to parse and have each individual element and attribute inserted into an oracle table for manipulation.
    Eg: XML File...
    <PERSON>
    <PER_ID changed="1">1</PER_ID>
    <SURNAME changed="1">MARTIN</SURNAME>
    <ADDRESS>
    <STREET_NO changed="1">1</STREET_NO>
    <POSTCODE changed="1">LE3 8RA</POSTCODE>
    </ADDRESS>
    </PERSON>
    There will only ever be one address.
    From this I need to extract
    * PER_ID and related changed attribute
    * SURNAME and related changed attribute
    * STREET_NO and related changed attribute
    * POSTCODE and related changed attribute
    and insert a single record into the table below:
    CREATE TABLE PERSON AS
    ( PER_ID VARCHAR2(10)
    , ID_CHANGED VARCHAR2(1)
    , SURNAME VARCHAR2(30)
    , ID_CHANGED VARCHAR2(1)
    , STREET_NO VARCHAR2(5)
    , ID_CHANGED VARCHAR2(1)
    , POSTCODE VARCHAR2(10) );
    Any assistance/advice would be very much appreciated. I've tried using DBMS_XMLSave / DBMS_XMLStore which works great at pulling in elements (PER_ID, SURNAME, etc) straight into the table but doesn't look at the changed attributes, and I need both.
    Thanks a million in advance to anyone who can crack this!!
    Jay

    Try looking at this thread
    Loading datafrom a PL/SQL table into the Database table

  • Read Cost element attributes

    Folks,
    Cost Element InfoObject has a attribute "Type".
    Different values for "Type" = 1,2,3
    Cost element is a time dependent compounded InfoObject. Hence I need to pass the value of related controlling area and time.
    How do I read the value of  attribute "Type"?
    I have tried using ATRV & ATRVT, but without any luck.
    Would appreciate if you could give an example for deriving the attribute value from a compounded time dependent InfoObject.
    Thanx,
    Raghu

    Thanx Anurag, but not very sure if I can use Charateristic relationship.
    I need to obtain the value of the attribute in a fox function. Let me explain it further.
    Background :
    Planning area -
    Charac----
    KF
    area1 -
    Payscale group--- Amount
    Cost element------AmountVR
    area2--Payscalegroup----KF1
    KF2
    KF3
    Cost Element has an attribute "Type"
    Value for attribute "Type" = 1,2,3
    Based on the value of the attribute, the corresponding KF needs to be multiplied.
    Logic :
    If type = 1.
    AmountVR = Amount * KF1.
    elseif type = 2.
    AmountVR  = Amount * KF2.
    elseif type = 3.
    AmountVR  = Amount * KF3.
    endif.
    The problem I'm facing is that I'm not able to read the data of attribute "Type". None of the below statement retrieve the value of the "Type".
    TYPE = ATRV(Attribute,COSTELEMENT,CO_AREA)
    or
    TYPE = ATRV(Attribute,COSTELEMENT)
    Could you please help me in reading from a time dependent compounding InfoObject?
    Regards,
    Raghu

  • How to read xml elements in Bpel

    Hi,
    I had created an empty Bpel Process and configured file adapter to a directory, In my text file i have 3 records with four columns, each column seperated by ',' and each record seperated by "EOL(end of line)", Below is the xsd file generated by the native format xsd builder, taken a recieve activity to recieve the contents of file from file adapter.
    So all the data which is in the file will be there in recieve activity.
    FileContents
    55555,rgfdgsd,gfdgfdg,23
    66666,retretret,trtertg,21
    77777,rtrttreter,trtter,23
    My Question is
    I want to compare whether value of C1 = '55555' and if the value is equal to 55555 then that record with c1=55555 has to be inserted into database
    How to compare the value of c1 through bpel functions.
    with java i have to use the logic similar to this by using Xpath
    getElement by tagname(c1);- it will give all the elements with tagname c1, three records are there with tagname c1 (c1=55555,c1=66666,c1=77777), we have to iterate through the elemnts and check whether the value iof c1='55555' and get the whole parent block which contains values of c1,c2,c3,c4 and insert that to database
    What variables we have to use to get the Similar logic in bpel
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    targetNamespace="http://TargetNamespace.com/FileAdapter"
    xmlns:tns="http://TargetNamespace.com/FileAdapter"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
    <xsd:element name="Associates">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Associate" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C1" type="xsd:double" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="C4" type="xsd:double" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    Please Look into this and suggest me the solution.
    Regards

    Hello,
    Create a transform between the out variable of you receive activity and in variable of your db adatpter.
    The use an IF in you tranformation file.
    Sample code
    <xsl:template match="/">
    <ns0:TestRahulCollection>
    <xsl:for-each select="/tns:Root-Element/tns:element">
    *<xsl:if test="xp20:matches(tns:C1,'55555')">*
    <ns0:TestRahul>
    <ns0:a1>
    <xsl:value-of select="tns:C1"/>
    </ns0:a1>
    <ns0:a2>
    <xsl:value-of select="tns:C2"/>
    </ns0:a2>
    <ns0:a3>
    <xsl:value-of select="tns:C3"/>
    </ns0:a3>
    <ns0:a4>
    <xsl:value-of select="tns:C4"/>
    </ns0:a4>
    </ns0:TestRahul>
    </xsl:if>
    </xsl:for-each>
    </ns0:TestRahulCollection>
    </xsl:template>
    Thanks
    Rahul

  • Replacing harcoded XML element attributes with variables

    Is there any way for Xpath expressions in JAVA to refer to variables (for an attribute) instead of harcoded strings (like 'abc' and 'xyz' below)
    So below ... 'abc' , 'xyz' could be varaibles.....
    String getServerInstance="/Accounts/Account[@code='abc']/TestingProgram[@code='abc']/Modes/Mode[@code='xyz']/*";
    Thanks a lot

    I have a class now that resolves variables:
    public class Resolve_Xpath_Vars implements XPathVariableResolver
         public Object resolveVariable(QName var)
    try {          
              if (var.equals(new QName("pqr")))
                        return new String("pqr");
              else if (var.equals(new QName("abcde")))
                        return new String("abcde");
    else
    return null;
    catch (Exception ex)
              ex.printStackTrace();
              throw new RuntimeException();     
    NOWWWWW
    how do i configure my XPATH expression to call this class to reolve my varaible....
    XPATH EXPRESSION IS:
    "this.Account" is the variable that the class should resolve.....to "pqr"
    String getAccnt="/Accounts/Account[@code="+"'"+*this.Account*+"'"+"]/*";      
    Once resolved to "pqr" then i can make the following call:
    NodeList nodeList =(NodeList) xPath.evaluate(getAccnt, inputSource, XPathConstants.NODESET );
    any help is appreciated.............

  • Parse XML Elements/Attributes from CLOB in PL/SQL

    Hi folks,
    I'm new to XML development in Oracle...I need some help in Parsing a XML stored in a CLOB column using PL/SQL.
    We are using Oracle 9i R2. Do i need install the XDK and /or XML DB?
    Basically the xml has some quiz questions and the answers to the quiz. Once student submits the quiz we need parse the XML and calculate the grade.
    Any help is appreciated...
    Thanks,

    A bit dirty but this works:
    Create an XMLType based on the CLOB contents...
    select extractvalue(value(x), '/PERSON/PER_ID/text()') PER_ID, extractvalue(value(x), '/PERSON/PER_ID/@changed') PER_ID_CHG
    , extractvalue(value(x), '/PERSON/SURNAME/text()') PER_SURNAME, extractvalue(value(x), '/PERSON/SURNAME/@changed') PER_SURNAME_CHG
    , extractvalue(value(x), '/PERSON/ADDRESS/STREET_NO/text()') PER_STREET_NO, extractvalue(value(x), '/PERSON/ADDRESS/STREET_NO/@changed') PER_STREET_NO_CHG
    , extractvalue(value(x), '/PERSON/ADDRESS/POSTCODE/text()') PER_POSTCODE, extractvalue(value(x), '/PERSON/ADDRESS/POSTCODE/@changed') PER_POSTCODE_CHG
    from table(xmlsequence(extract(xmltype('
    <PERSON>
    <PER_ID changed="1">260180</PER_ID>
    <SURNAME changed="2">MARTIN</SURNAME>
    <ADDRESS>
    <STREET_NO changed="3">1</STREET_NO>
    <POSTCODE changed="4">LE3 8RA</POSTCODE>
    </ADDRESS>
    </PERSON>')
    , 'PERSON')
    ) x;

  • Need to replace/modify an element attribute

    Hi,
    I need to read an XML file and modify the value of an XML element attribute and write the modified element back to the file. This element is two levels deep in the heirarchy,
    currently i am reading all the children and modifying the value of this particular attribue and writing all the children back.
    Does anybody know of a method where we can do a replace operation on the Document rather than the lengthy process that i am currrently using??
    Thanks

    you might want to look at STX streaming transforms-
    http://www.xml.com/pub/a/2003/02/26/stx.html
    That seems a good match for a simple replace problem.
    Pete

  • [JS-CS4] - How to read the XML Element and its Attributes

    Dear All,
      I have the doubt regarding: reading the xmlElement and its attributes.
    Here I droping the xml script
    //============= Start ======================//
    var myDoc = app.activeDocument;
    var Fpath = File("../Projects/Entity_map.xml");
      if (Fpath.exists)
       Fpath.open("r");
       var Cont= Fpath.read();
      var roots = new XML(Cont);
      var myEveryName = new Array();
      var myEveryContent = new Array();
      var myEveryAttributes = new Array();
      traverse(roots);
    //$.writeln(myEveryName);
    //$.writeln(myEveryContent);
    $.writeln(myEveryAttributes.length);
    for(var i=0; i<myEveryAttributes.length; i++)
      $.writeln(myEveryAttributes[i]);
    function traverse(tree) {
        myEveryName.push(tree.name());
    myEveryContent.push(tree.text());
      myEveryAttributes.push(tree.getAttribute);
    // you get the contents by using .text() insted of .name()
        if(tree.elements().length() > 0) {
            for(var i=0; i<tree.elements().length(); i++) {
                traverse(tree.elements()[i]);
    //============== End =====================//
    and the XML Structure is
    //===============XML =====================//
    <?xml version="1.0" encoding="UTF-8"?>< Entity_Convertion>
    < Entitys char="Ç" GID="173"/></ 
    Entity_Convertion>
    //===============End ====================//
    Here I'm getting the XML Elements and its contents, but not xmlAttributes.
    Please any one can help me, then I will appreciate...
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear All,
      I have the doubt regarding: reading the xmlElement and its attributes.
    Here I droping the xml script
    //============= Start ======================//
    var myDoc = app.activeDocument;
    var Fpath = File("../Projects/Entity_map.xml");
      if (Fpath.exists)
       Fpath.open("r");
       var Cont= Fpath.read();
      var roots = new XML(Cont);
      var myEveryName = new Array();
      var myEveryContent = new Array();
      var myEveryAttributes = new Array();
      traverse(roots);
    //$.writeln(myEveryName);
    //$.writeln(myEveryContent);
    $.writeln(myEveryAttributes.length);
    for(var i=0; i<myEveryAttributes.length; i++)
      $.writeln(myEveryAttributes[i]);
    function traverse(tree) {
        myEveryName.push(tree.name());
    myEveryContent.push(tree.text());
      myEveryAttributes.push(tree.getAttribute);
    // you get the contents by using .text() insted of .name()
        if(tree.elements().length() > 0) {
            for(var i=0; i<tree.elements().length(); i++) {
                traverse(tree.elements()[i]);
    //============== End =====================//
    and the XML Structure is
    //===============XML =====================//
    <?xml version="1.0" encoding="UTF-8"?>< Entity_Convertion>
    < Entitys char="Ç" GID="173"/></ 
    Entity_Convertion>
    //===============End ====================//
    Here I'm getting the XML Elements and its contents, but not xmlAttributes.
    Please any one can help me, then I will appreciate...
    Thanks & Regards
    T.R.Harihara SudhaN

  • Imported XSLT cannot create attributes for generated XML element

    I have two xslts. One imports the other.
    The imported xslt creates XML elements with attributes and this XML is stored in a variable in the main stylesheet
    If I perform the transformation with JRE prior to 1.6.0.18 then all works fine
    If I use 1.6.0.18 or 1.6.0.19 then the attributes aren't added.
    If I add attributes in the main xslt it works fine or if I output the element directly instead of first storing it in a variable then it also works fine.
    Problem seems to be when you try to add attributes from an imported stylesheet and store the generated element in a variable.
    Below two stylesheets to illustrate :
    First MainStylesheet.xsl
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Copyright 1993-2005 Seagull Software Systems, Inc. -->
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:exsl="http://exslt.org/common"
    extension-element-prefixes="exsl"
    exclude-result-prefixes="xs">
    <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" />
    <xsl:import href="innerstylesheet.xsl"/>
    <xsl:template match="/TestData">
    <xsl:variable name="generatedElementXml">
    <xsl:call-template name="generateElement">
    <xsl:with-param name="s">testValue</xsl:with-param>
    </xsl:call-template>
    </xsl:variable>
    <xsl:for-each select="exsl:node-set($generatedElementXml)">
    *** GeneratedElementXML {<xsl:text>
    </xsl:text><xsl:copy-of select="*"></xsl:copy-of>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>Next innerstylesheet.xsl
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:exsl="http://exslt.org/common"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    extension-element-prefixes="exsl" >
            <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
            <xsl:template name="generateElement">
                       <xsl:param name="s"/>
                    <TestElement testAttribute="$s" />
            </xsl:template>
    </xsl:stylesheet>The result output by jres before 1.6.0.18 is :
    <?xml version="1.0" encoding="UTF-8"?>
                   *** GeneratedElementXML {
              <TestElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" testAttribute="testValue"/>
                   }          The result output by jres since 1.6.0.18 is :
    <?xml version="1.0" encoding="UTF-8"?>
                   *** GeneratedElementXML {
              <TestElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                   }          Note : the 'testAttribute' attribute is missing

    Have found the difference in the code
    In both JRE1.6.0_17 & JRE1.6.0_18, the class 'com.sun.org.apache.xalan.internal.xsltc.dom.AdaptiveResultTreeImpl' has the following method
    public void addUniqueAttribute(String qName, String value, int flags)
            throws SAXException
            addAttribute(qName, value);
        }In JRE1.6.0_17 the next method is
    public void addAttribute(String name, String value)
         if (_openElementName != null) {
             _attributes.add(name, value);
         else {
             BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, name);
        }In JRE1.6.0_18 the next method is
    public void addAttribute(String uri, String localName, String qname,
                String type, String value)
         if (_openElementName != null) {
             _attributes.addAttribute(uri, localName, qname, type, value);
         else {
             BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, qname);
        }Note - the addAttribute method has additional parameters in JRE1.6.0_18 but the call from addUniqueAttribute wasn't updated.
    So in JRE1.6.0_18 addUniqueAttribute actually invokes the following method in the base package com.sun.org.apache.xml.internal.serializer.EmptySerializer
    public void addAttribute(String name, String value)
            aMethodIsCalled();
    void aMethodIsCalled()
            // throw new RuntimeException(err);
            return;
        }and as you can see this does nothing. Hence the fact that the attribute isn't added.

  • XML element,if not including any attributes and/or child elements then

    XML element in SQLX,if not including any attributes and/or child elements then the tag should not appear, how to achive this?
    ex:Consider for <enumeration> tag where it is having some value.
    <attribute>
    <name>Ethernet Access</name>
    <enumeration>
    <StringValue>Bandwidth</StringValue>
    </enumeration>
    </attribute>
    When <enumeration> tag is not have any Value in this, then output should be as follows.
    <attribute>
    <name>Ethernet Access</name>
    </attribute>
    But what i am getting is
    <attribute>
    <name>Ethernet Access</name>
    </enumeration>
    </attribute>
    Please suggest me the solution for this.
    I tried , but when xmlelement() is not having data it will display empty tag ie </enumeration>, If xmlforest() are null it wont show tag, But i have to use xmlelement only. how can that be achived using xmlelement .

    Use a SQL case - when - else end construct to only execute the xmlelement if data is present. The SQL/XML standard is very clear, xmlElement will generate an empty element if no data is present. xmlforest will not.

Maybe you are looking for

  • WSDL generation

    Hi, Please let me know how do we generate WSDL from the outbound interface in PI 7.1. Thanks and Regards, Rana

  • Trouble with the trial download.

    The trial download installs the start over and does this again and again but never goes any further. What is wrong?

  • How to execute a servlet onload

    Hi everyone, I am very new to servlets. I have a jsp page that calls a servlet which is executed on a submit button within a form. It works, returning the data to the page. However I would like my servlet to be executed on load of the jsp. A tutorial

  • I am having trouble Activating my old Macromedia Studio MX software (Dreamweaver and Flash)

    I have installed my old software, entered the serial number properly, but when i try to activate it. It gives me a network error message. Any ideas on how to work around this? I tried the activation phone number, but that number is down. Frustrated,

  • Can anyone help with gstreamer....[Solved]

    ERROR: Caught a segmentation fault while loading plugin file: /usr/lib/gstreamer-0.10/libgstaudioresample.so Please either: - remove it and restart. - run with --gst-disable-segtrap and debug. thats after last update .... Guess its Banshee again ....