How to read a xml node name in xsl? Urgent!

Hi,
I've a dynamic xml which gets generated at runtime. The basic nodes remain same but the content and nodes vary.
- <root>
- <list>
- <row>
<courseStartDate></courseStartDate>
<courseEndDate></courseEndDate>
<courseName>ORACLE</courseName>
</row>
- </list>
</root>
I have an xsl which would read the values
as :
<xsl:value-of select="courseStartDate"/>
I would like to know if its possible to read the node name "courseStartDate" through xsl, which could be stored in a variable and then the corresponding value could be retrieved??
Thanks

If u want to display the name : value then u can do like this
<xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" />

Similar Messages

  • ABAP MAPPING Querry - How to create Different Target NODE NAME as of Source

    Hi,
    In abap Mapping
    <b>DATA READ FROM SOURCE XML NODE into <u>incode</u></b> ******
    data: incode type ref to if_ixml_node_collection.
    incode = idocument->get_elements_by_tag_name( 'BUSINESS_DAY' ).
    <b>CREATE OUTPUT XML NODE WITH SAME NAME AS <u>'BUSINESS_DAY'</u></b> **
    data: outcode type ref to if_ixml_node.
    outcode = incode->get_item( index = 0 ).
    data irc type i.
    irc = msgtype->append_child( outcode ).
    *<b>BUT TO CREATE OUTPUT XML NODE WITH <u>DIFFERENT NAME AS 'BUSS_DAY'</u></b>*
    data: ws_val type string VALUE 'xyz'.
    data: elementsender type ref to if_ixml_element.
    elementsender = odocument->create_simple_element(
    name = 'BUSS_DAY'
    value = ws_val
    parent = msgtype ).
    <b>Please guide me how I can assign <u>incode</u> value to ws_val.
    So that I can generate <u>OUTPUT XML NODE with different name as of SOURCE XML NODE</u></b>
    i.e. How to create Different Target NODE NAME as of
    Source with same Data
    <Note>: I am using "How to... Use ABAP Mapping in XI 3.0 ver.1.00" and to create different NODE name as of source
    is not given in it.
    Thanks & Regards.

    Hi ABAPers,
    Please Guide Me .....
    <u>This is ABAP Mapping problem in XI.</u>
    <b>How can I read data from incode into ws_val.</b>
    data: <b>ws_val</b> type string
    data: <b>incode</b> type ref to if_ixml_node_collection.
    <b>incode</b> = idocument->get_elements_by_tag_name( 'BUSINESS_DAY' ).
    Best Regards

  • How to find PG.xml file name and path associated with a FUNCTION

    Hi,
    I am having a function:IRC_VIS_HOME_PAGE with Web HTML value as below:
    OA.jsp?akRegionCode=IRC_VIS_HOME_PAGE&akRegionApplicationId=800&OAPB=IRC_BRAND
    How to find PG.xml file name and path assoicated with above funtion.
    Thanks,
    ashok

    Ashok,
    Function IRC_VIS_HOME_PAGE will have 2 parameter defined for it which are OASF and OAHP where
    OASF=<SelectedFunctionName> - this tells the Framework to select this function in the given "Home Page" menu context.
    OAHP=<HomePageMenuName> - this is used ONLY with the OASF parameter, and it is used to establish the current menu context. It should point to a "Home Page" menu.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • GET XML NODE NAME FOR LOOPING

    Hi,
    i hv a procedure to get the xml data's(values of the xml) from a clob. in a table.it works fine the parent tags but if the same tag is there for two times then i am not able to loop it because i dont know the tag name for which the loop should be run.
    to be clear.
    <root>
    <tag1>value1
    </tag1>
    <tag1>value2
    </tag1>
    </root>
    i need to run some fns for each node value so i need to loop for each node having same value pls help me to get the node name.

    You can simply alter get xml node name in loop to return a count on just the node you are looking for. Not sure why you need to know the count when you can have the logic iterate through the nodes for you, either as an XMLType or a DOMDocument (see nodelist).

  • Get xml node name from clob in loop

    Hi,
    i hv a procedure to get the xml data's(values of the xml) from a clob. in a table.it works fine the parent tags but if the same tag is there for two times then i am not able to loop it because i dont know the tag name for which the loop should be run.
    to be clear.
    <root>
    <tag1>value1
    </tag1>
    <tag1>value2
    </tag1>
    </root>
    i need to run some fns for each node value so i need to loop for each node having same value pls help me to get the node name.

    You can simply alter get xml node name in loop to return a count on just the node you are looking for. Not sure why you need to know the count when you can have the logic iterate through the nodes for you, either as an XMLType or a DOMDocument (see nodelist).

  • How to read an xml file from headers

    Hi ,
    I am not getting how to read an xml file sent by client device in header to server.
    Thankx.

    There is a getHeader() in HttpServletRequest interface
    String locationURL=request.getHeader("Location");If URL of your file was set in Location attribute of header.
    Edited by: ngpgeeta on Dec 19, 2008 8:03 AM

  • Accessing Node Name in XSL

    Hi all,
    Is there some way I can access the node name of a node when I'm in an xsl, perhaps some kind of xpath statement, for example, I have the following:
    <row>
    <agreement>test</agreement>
    <date>today</date>
    </row>
    When I access all the child nodes of the row element, how can I find out the name of each child node, like "agreement" and "date"? thanks in advance.

    I Think this will help u
    <xsl:template match="/">
    <xsl:for-each select='.//row'>
    Node Name is : <xsl:value-of select="name()"/>
    <xsl:for-each select='./@*'>
    Attribute Name is :<xsl:value-of select="name()"/>
    Attribute Value is :<xsl:value-of select="."/>
    </xsl:for-each>
    Node value is : <xsl:value-of select="."/>
    </xsl:for-each>
    </xsl:template>
    Regards
    John Bruno
    508-740-2696

  • How to binding incoming xml node list to the tree control as dataProvider

    Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
    Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
    Please see the presudo-code here:
    1.  Model layer(CsModel.as)
    public class CsModel
            [Bindable]
            public var treeXML:XML=<nodes><car label="virtualOne" id="1">
                                   </car></nodes>;
            (Here, I want to build binding relationship on the <car/> node,
             one 'virtual/stub' node is set here with lable="virtualOne".
             But this node will be deleted after IdTree
             control is created completely.)      
            [Bindable]
            public var treeData:XMLList =new XMLListCollection(treeXML.car);
    2. view layer(treePage.mxml)
            private var _model:CsModel = new CsModel();
            private function addNode():void
                    var newNode:XML=<car/>;
                    newNode.@label="newOne";
                    newNode.@id=1;
                    _model.treeXML.appendChild(newNode);
                             private function cleanData():void
                                     delete _model.treeXML.car;
            <mx:VBox height="100%" width="100%">
            <mx:Button label="AddNode" click="addNode()" />
            <mx:Tree id="IdTree"  labelField="@label"
              creationComplete="cleanData()"
              dataProvider="{_model}"/>
        </mx:VBox>
    3. Top view layer (App.Mxml)
    <mx:application>
        <treePage />
    </mx:application>
    For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
    So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?

    If u want to display the name : value then u can do like this
    <xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" />

  • How to read an XML from a servlet?

    Hi,
    I'm just starting programming and now I have a problem I can't solve. I hope someone can help me.</p>
    On the client side I have a xml report and a script wich sends to the server the information I've got from the report. In this case, the 'Poliza' value.
    On the server-side I have a servlet. I try to get the parameters (from the URL or from the XML), but I don't have any response on the client side. I'm sure I'm doing something wrong but I can't find the solution for solving it.
    I suppose there are two ways of solving the problem.
    - Make an http connetion and send just the parametes on the URL? Does anyone know how to make it?
    - Reading the XML on the servlet and extract the parameters the script sent. Does anyone know how to read it?
    Thank you in advance
    I attach part of the code.
    CLIENT SIDE
    <report....>
    <field sortid="0" id="Poliza" inputtype="textbox" label="Poliza" rows="1" wide="false" required="false"/>
    </report>
    <script name="ValidacionOnlineValidation1" script="if (0 == 0){
    var szURL="http://URLServer/vonline/vonline?Poliza="+Poliza.value;
    var szUserAgent = "JoP-XML_Posting_v1.0";
    var m_XML;
    /* In the line below, construct a XML-document that contains all the information you need to send to the server*/
    var szXML = "<?xml version=\"1.0\"?><data><objects><object name=\"Poliza\" value=\"123456789\"/></objects></data>";
    /* Create an instance of the MS XML Document Object Model Parser*/
    m_XML= new ActiveXObject("Microsoft.XMLDOM");
    m_XML.validateOnParse=true;                                                                                                         
    var bLoadResult = m_XML.loadXML(szXML);
    if (bLoadResult==true) {
      /*Instance of the transport object, method,...*/
      var m_HttpReq = new ActiveXObject("Pocket.HTTP");
      m_HttpReq.method = "GET";
      m_HttpReq.Headers.create("Content-Type", "text/xml");
      m_HttpReq.Headers.find ("User-Agent").Value = szUserAgent;
      m_HttpReq.timeout = 150000;
      /*Do the actual post of the data*/
      var m_HttpResponse = m_HttpReq.GetResponse(szURL,m_XML.xml);
      if (m_HttpResponse.statusCode==200) {...}
    SERVER SIDE
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
         String Error="";
         String MSG = "";
         response.setContentType("text/html");
         PrintWriter out1 = response.getWriter();
         Enumeration arrayparametros = request.getParameterNames();
         for (;arrayparametros.hasMoreElements();){
              String parametro = (String)arrayparametros.nextElement();
              String valorparametro = request.getParameter(parametro);
              if (parametro.equals("Poliza")){
                   vonlineLogica logica = new vonlineLogica();
                   LOGS ="on";
                   Respuesta respuesta = logica.procesarSolicitud(request,valorparametro);
                   Error = Respuesta.getError();
                   MSG = Respuesta.getMensaje();
              else{          
                   Error = parametro; MSG = valorparametro;
                   String[] values = request.getParameterValues(parametro);
         out1.println("Result: " + Error + " / " + MSG);
         out1.close();                    
    }

    Thanks by your help Shanu.
    Nevertheless, finally I tryed the easiest way (pass the parameter with 'GET'). Moreover I found why my code wasn't working. It was a fool thing. I though PDA connect throught a proxy, but it wasn't true. Whatever.
    Regards.
    FSG.
    The final script on the xml-report is:
    <report type="Validacion Online" required="false" multiple="false" attachments="false" scriptref="store://this/reportdef/script[@name='ValidacionOnlineValidation1']">
         <field sortid="0" id="Poliza" inputtype="textbox" label="Poliza" rows="1" wide="false" required="false"/>
    </report>
    <script name="ValidacionOnlineValidation1" script="if (0 == 0)
    var szURL="http://URL/vonline/vonline?parameter1=";+Poliza.value;                         
    var m_HttpReq = new ActiveXObject("Pocket.HTTP");                                             m_HttpReq.timeout = 15000;
    var m_HttpResponse = m_HttpReq.GetResponse(szURL,"");
    window.alert(m_HttpResponse.string);
    if (m_HttpResponse.statusCode==200)  {....}
    else {....}

  • How to read an XML file into a java program?

    hi,
    i want to load the following very simple xml file in my java program.
    <root>
    <weblogic>
    <url value="t3://192.168.1.160:7001" />
    <context value="weblogic.jndi.WLInitialContextFactory" />
    </weblogic>
    </root>
    I am getting the error: " Line=1: cvc-elt.1: Cannot find the declaration of element 'root'."
    What might be the problem can anyone help me out.
    My java class code is:
    public class BIXMLReader {
    /** All output will use this encoding */
    static final String outputEncoding = "UTF-8";
    // Parses an XML file and returns a DOM document.
    // If validating is true, the contents is validated against the DTD
    // specified in the file.
    public static Document parseXmlFile(String filename, boolean validating) {
    try {
    // Create a builder factory
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setIgnoringComments(false);
    factory.setIgnoringElementContentWhitespace(false);
    factory.setCoalescing(false);
    factory.setValidating(validating);
    // Create the builder and parse the file
    System.out.println("filename = " + filename);
    DocumentBuilder db = factory.newDocumentBuilder();
    // Set an ErrorHandler before parsing
    OutputStreamWriter errorWriter = new OutputStreamWriter(System.err, outputEncoding);
    db.setErrorHandler(new MyErrorHandler(new PrintWriter(errorWriter, true)));
    Document doc = db.parse(new File(filename));
    System.out.println(doc.toString());
    return doc;
    } catch (SAXException e) {
    System.out.println("A parsing error occurred; the xml input is not valid. " + e.getMessage());
    } catch (ParserConfigurationException e) {
    System.out.println("Parser configuration exception has occured");
    } catch (IOException e) {
    System.out.println("IO Exception has occured " + e.getMessage());
    return null;
    // Error handler to report errors and warnings
    private static class MyErrorHandler implements ErrorHandler {
    /** Error handler output goes here */
    private PrintWriter out;
    MyErrorHandler(PrintWriter out) {
    this.out = out;
    * Returns a string describing parse exception details
    private String getParseExceptionInfo(SAXParseException spe) {
    String systemId = spe.getSystemId();
    if (systemId == null) {
    systemId = "null";
    String info = "URI=" + systemId +
    " Line=" + spe.getLineNumber() +
    ": " + spe.getMessage();
    return info;
    // The following methods are standard SAX ErrorHandler methods.
    // See SAX documentation for more info.
    public void warning(SAXParseException spe) throws SAXException {
    out.println("Warning: " + getParseExceptionInfo(spe));
    public void error(SAXParseException spe) throws SAXException {
    String message = "Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    public void fatalError(SAXParseException spe) throws SAXException {
    String message = "Fatal Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    }

    ok thanks, i can get the elements, but why did it not validate it?
    I want to read the child nodes of "weblogic" not by their name but by their index. Because i dont want to confine the reader so i want to read all the child nodes of weblogic (looping over them). i m doing the following but its not returning me the correct result and giving me the wrong count of child nodes.
    Element elementNode = (Element)doc.getElementsByTagName("weblogic").item(0);
    NodeList nodeList = elementNode.getChildNodes();
    int length = nodeList.getLength();
    System.out.println("length = "+ length); // the length its giving is 5 but i shuld get only 2
    for(int i=0; i < length; i++) {
    Element elmChild = (Element) nodeList.item(i);
    System.out.println(elmChild.getAttribute("value"));
    what might be the problem?

  • HELP NEEDED!!!displaying xml node name in an input text box

    Hello everybody
    Have a simple proble. I have imported an XML file into flash
    using the Tree component and the XML_conn component. So i have the
    xml tree displying in flash when i have run it.
    I have created an input text box called 'subject'
    All i really need is when a user clicks on any node for that
    node name to be displayed in a the input text box. thats it. ITS
    DRIVING ME CRAZY

    Try something like this. (if your Tree is called myTree)
    var myTreeListener = {}
    myTreeListener.change = function(evtObj) {
    subject.text = evtObj.target.selectedNode.nodeName;
    myTree.addEventListener("change",myTreeListener)

  • How to get the XML TAG name itself instead of TAG value

    Hi All,
    I have a question here
    I want to retrieve the XML tag from a XML file instead of its value.
    Example:
    <item>Colgate</item>
    Now I want to retrieve "item" as output from XPath expression, I dont want its value as "colgate"
    How to do that...?
    Thanks
    -Praveen

    You can do this with an axes XPatch expression:
    child::node()/name()
    For more info see: http://www.w3schools.com/xpath/xpath_axes.asp
    HTH,
    Bas

  • WebDynpro 4 Java & Persistence options : Any Idea how 2 read an XML?

    Hi,
    I was wondering if there is an easy way to store modified (or new) values in a WebDynpro application.
    e.g. A User adds a new row to an existing Table UI in Web Dynpro application with create button. I want to save this row either in an XML file, in a table connecting to database or in an ABAP table via RFC connection. Which option is a light (on resources?) and easy to implement. I think it's reading and writing to an XML file. What are the other options, if any?
    I've been trying to read an xml file (stored under src/mimes/Components/<com.sap.myComp>/test.xml as below:
    //controller code
    private static final String FILE_NAME = "test.xml";
    private static final WDWebResourceType FILE_EXT = WDWebResourceType.XML;
    IWDResource resource = WDWebResource.getWebResource(wdComponentAPI.getDeployableObjectPart(), EditView.FILE_EXT, EditView.FILE_NAME);
    wdContext.currentContextElement().setFile(resource);
    //end controller code
    //view Init() code
    IWDResource resource = wdContext.currentContextElement().getFile();
    File file = new File(resource.getResourceName().toString());
    /* I've also tried below
            FileInputStream fis = null;
         fis = new FileInputStream(file);
            url = file.getAbsolutePath();
            //url is null when printed?
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(file);
    doc.getDocumentElement().normalize();
    content = doc.getDocumentElement().getNodeName().toString();
    //end view Init() code
    When I print the value of content, I get it's initial value which is null. What is wrong?? any ideas?
    How to get the correct path to the stored xml and how to display its contents? I've read enough posts on SDN but couldn't get it working.
    Appreciate your help.
    Regards,
    N.

    hi,
    U r retriving the elements by tag name.So it just chks the tag name ie.<book> & gives u array of elements.But u need retrive d attribute of <book> tag itself.
    =Solution =====
    Add one more statement ----> var[]= doc.getElementsByName("book");
    Now u hav book elements as an array & can retrive id in for loop
    for(var; var.length;var++)
    doc.element[var].id.value

  • Dashes in xml node names

    I need to parse an xml document returned by a web-service. It does not, nor do we want it to, follow any SOAP or wdsl standard.. However I still need to parse it (hence the flex becomes unflexible).
    Some of the nodes names in the xml document have dashes it is.. (ex. <node-name></node-name>) However flex does not let me access these nodes..
    If I try and parse a mx.rpc.events.ResultEvent thus :
    someObject = event.result.root.node-name as someObjectType;
    I get an error: 1120: Access of undefined property structure.  ...  line 16    1253139374175    81
    However when I traverse the event object in the debugger.. the result.root.node-name object is in debugger as an ObjectProxy.. so what gives? I have to use boring one word node names? Is Flex so inFlexible?

    Hey! thanks for the advice! I did try this, but I don't think I was using the object correctly. I wast to try and bind the text value of an xml node to a control Object..
    Back to the books, then
    Thanks again,

  • Get xml node name in loop

    Hi,
    i hv a procedure to get the xml data's(values of the xml) from a clob. in a table.it works fine the parent tags but if the same tag is there for two times then i am not able to loop it because i dont know the tag name for which the loop should be run.
    to be clear.
    <root>
    <tag1>value1
    </tag1>
    <tag1>value2
    </tag1>
    </root>
    i need to run some fns for each node value so i need to loop for each node having same value pls help me to get the node name.

    pls help me to get the node name.Still not sure what you are actually trying to accomplish, but maybe this helps:
    SQL> set echo on
    SQL> col node form a30
    SQL> with xml as (
    select xmltype('<root>
    <tag1>value1
    </tag1>
    <tag1>value2
    </tag1>
    </root>') xml from dual)
    select t.column_value.getrootelement() node
      from xml xml,
    table (xmlsequence(xml.xml.extract('//*'))) t
    NODE                         
    root                         
    tag1                         
    tag1                         
    3 rows selected.

Maybe you are looking for

  • Relink files to pluraleyes xml file

    Hi, I'm a videography student working in a team, and we are having some problems with filesharing. We have done a bunch of multi-camera shooting, and synched most of the clips in FCPX with multicam. For some reason the multicam clip for one interview

  • Object Libraries in CS2

    I'm been using the InDesign Object Libraries for a while now and we continue to have problems with them. The first issue is when I place pages (with images and text) from the libraries some of the images come up as gray boxes. It isn't consistent. So

  • Unable to view and access files

    Since updating to Yosemite on my MacBook Pro (early 2011), I have been unable to view and access files on my time capsule. I can still access my backups through Time Machine, but not able to view or access the files that I saved onto the device (by m

  • PSE 12

    I tried to install PSE 12 as an upgrade to PSE 9 on a Win 7 netbook (50+ GB diskspace available). The installation stops at about 95% without an error-message, de-installation didn't work too. So I deleted all PSE 12-files I could find manually and t

  • Feature Request - Ability to organize content holder, media downloads, etc

    Are there any plans to add a feature to BC to allow admins/users to organize things like content holders, media downloads, news, etc? We would really like the ability to be able to tag these items (or something) and then search for these items in adm