XSL select node type

If I have an xsl:template select-expression that can select both say <html:h1> and <html:h2>, is there a way in XSL of inspecting the elements of the resulting node-set and distinguishing which ones were <h1> and which were <h2>?
Probably blindingly obvious ... but not to me ;-(

I think the function is localname()? Or maybe local-name()?
That returns the name of the currentNode...maybe.
I have no xsl testy framework thing here since I haven't needed it for the current job, so you may want to take this with a pinch of salt.
So...if I'm right...something like:
<xsl:if test="local-name() = 'h1'">
do stuff.
</xsl:if>May need namespaces and the like, but I think that's the general structure.
...I hate trying to write this stuff "blind"...

Similar Messages

  • Xsl:selecting nodes in ascending order

    Hi,
    Could anybody please answer this query.
    I have the following xml
    <Root>
    <Child>
         <number>1</number>
    </Child>
    <Child>
         <number>3</number>
    </Child>
    <Child>
         <number>4</number>
    </Child>
    <Child>
         <number>6</number>
    </Child>
    <Child>
         <number>7</number>
    </Child>
    <Child>
         <number>10</number>
    </Child>
    </Root>
    Now from xsl i need to select Child nodes in ascending order based on the <number> tag within <Child> node.
    Also at max there will be 10 child nodes,As the loop goes and retrives the nodes,I need to know which nodes
    have gone missing as i need to do some thing if a node is missing {For example in the above xml Child nodes
    with number 2,5,8,9 are missing.
    Is there any way I can do this?
    Thanks and Regards,
    Deepak                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    There's <xsl:sort> if you want to process a node set in ascending sequence. And there's the preceding-sibling axis if you want to look at a previous sibling node. You would want to test whether the preceding sibling's number element was one less than the current node's number element.

  • How to make a control to let the user to select a type of line?

    Dear All,
    I want to make a control to let the user can select a type of line from some types. Just like selecting the line type of plot in the graph.
    Is there any good way to do it, or is there any examples?
    Thank you.

    Hello,
    I think you can use a pict ring as selector and the detect value changes of that indicator to apply the new plot style on the graph using property nodes.
    Let me know if you need more help on this
    Message Edité par TiTou le 08-30-2006 01:50 PM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    palette.jpg ‏19 KB

  • How can I define a new Search Node type?

    Hi experts!
    I'm trying to modify PPOME transaction, but I can't create a new Search Node type. Can anybody give me the necessary steps I have to do? Other question, Is it possible to create a new Search Node for a Organizational unit? Or this only could be possible for new objects types?
    Thanks a lot,
    Regards,
    Rebeca

    Hi Rebeca,
    You need to create a Search node only if you create a new object type (e.g. ZP).
    For org unit, you don't need to create one (unless you wanna change search details)
    Otherwise, you can use existing search nodes for standard object types.
    What you can do is, you can add a search node to an existing scenario in order to make it visible in the object manager part (left-hand side of the screen).
    To create a new search node :
    Goto SPRO Personnel management - Organizational Management - Hierarchy Framework - Object manager - define your own search node -
    > Define search node : Add new entries here.
    To add a search node to a scenario (e.g. to make a new search node visible on the left-hand side of PPOME)
    Goto SPRO Personnel management - Organizational Management - Hierarchy Framework - Object manager - define your own search node -
    > Scenario Definition (Object manager) : Select the scenario (for PPOME it is OME000), double click the "Search nodes" and create new entries to add the search node here. Then double click the "Search tool", copy the lines of a similar search node and change search node field to the new one.
    Best regards,
    Dilek

  • How do I fix "Invalid node type: selectionbox" error?

    Ok I've got my document all made and nice and pretty, I use it to enter information and use the selection box to make visible the fields I need for each card. Then I save it and try to open it and get the following error popup message.
    Invalid node type: selectionbox
    Invalid node type: selectionbox
    Invalid node type: selectionbox
    Invalid node type: selectionbox
    Invalid node type: selectionbox
    Invalid node type: selectionbox
    Invalid node type: selectionbox
    Message limit exceeded. Remaining 10 errors not reported.
    So I click ok on the error box. It opens the file with adobe reader like it's supposed to and then immediately I get the "Adobe reader has stopped working, windows can check online for a solution to the problem" and I get the two choices that both involve closing the program.
    I got this once before and after about a half hour of fiddling with the original livecycle file it stopped doing it. I have no idea what I did to make it start or stop doing it and I'm not sure I even did do anything to cause it.
    Has anyone else come across this problem? Does anyone know what I need to do to fix it?
    I've included the file I'm having issues with.
    Thanks,
    Aaron

    Hi Aaron,
    I cant replicate your problem. What I did notice though, is when I make a selection on almost every selection box,  I get the following error:
    'cardtwo.TextField1 has no properties'. The error is coming from the following piece of code in the change event: 'cardtwo.TextField1.caption.text.value = (this.rawValue);'
    I dont see a TextField1 in the cardtwo subform so I suspect that this field has been renamed and / or moved since that bit of code was added. Perhaps that would be a good place to start and could very possibly be the cause of your problem.
    Dallas

  • Selected node in a tree table (via Data Controls and not managed bean)

    I am facing some problems in getting the selected row in a tree table.I have used data controls for creating the tree on the page.
    I have 3 POJO's,ex; Class AB which has a list of Class CD.And Class CD has a list of class EF. (Used for the tree table)
    Now i have a java class, called MyDelegate.java which has a list of AB.I generated data controls off this MyDelegate class and have dropped the ABlist as a tree table (also displaying CD and EF in the tree table).
    It displays fine with nodes of AB,CD (child of AB)and EF(child of CD)
    The tree table is not bound to any managed bean.
    For performing actions on the tree, i create a method - "doSomething() in the delegate class",generate data controls and drop it as a button.
    Inside doSomething(), i need acess to the selected node in the tree (it can be a node of type AB or CD or EF).
    The problem: I always get access to the node of type AB, and not the child nodes no matter what i click in the tree table.
    doSomething(){
    DCBindingContainer dcBindingContainer = (DCBindingContainer)ADFUtil.evaluateEL("#{bindings}");
    DCIteratorBinding dcTreeIteratorBinding = dcBindingContainer.findIteratorBinding("lstABIterator");
    RowSetIterator rowTreeSetIterator = dcTreeIteratorBinding.getRowSetIterator();
    DCDataRow rowTree = (DCDataRow)rowTreeSetIterator.getCurrentRow();
    if (rowTree.getDataProvider() instanceof AB) {
              //do something
              AB selectedAB = (AB)row.getDataProvider();
    } else if (rowTree.getDataProvider() instanceof CD){
              //do something
    } else if (rowTree.getDataProvider() instanceof EF) {
              // do something
    How do i access the "selected child node of the tree table" here in the delegate class method? Pls help.

    Hi Frank,
    Thanks for the response. In my case, i dont have a managed bean, so i am slightly unsure how to do it.
    There is a mention "Note that another way to access the treeTable component at runtime is to search for it in JavaServer Faces UIViewRoot. This latter option allows you to write more generic code and does not require to create a page dependency to a managed bean"
    How do i use this adf view root (without a managed bean) to get hold of the selected row in the tree table. Pls help.
    Thanks.

  • Get current Tree Select Node

    Hi,ALL
    I want to return JTree selection.
    As you know If use JTree object, we can use
    getSelectionPaths(), and use Treepah object method
    getLastPathComponent to get selected node.
    What I want to do is.
    My JTree Object model is DefaultMutableTreeNode
    i want to use DefaultMutableTreeNode to access selected Node.
    Can I do like this?
    If I can, how to do it?
    Thanks in advanced

    Hi,
    if you following that pdf ,
    i think your not implemented the below code in DomodifyView method
    if (firstTime) {
          IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TheNode");
          /* The following line is necessary to create parameter mapping from parameter "path" to parameter "selectedElement".
    Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
    that raised the onAction event. Parameter "selectedElement" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
    that handles the onAction. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
    be accessed within the event handler
          treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
          /* The following line is necessary to create parameter mapping from parameter "path" to parameter "element".
    Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
    that raised the onLoadChildren event. Parameter "element" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
    that handles the onLoadChildren. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
    be accessed within the event handler
          treeNode.mappingOfOnLoadChildren().addSourceMapping("path", "element");
    please cross check once.
    Thanks,
    Ramesh

  • Get tree selected node onPageLoad

    We just turned on change persistence to keep our row selections as we traverse our taskflows and pages.
    In one of our pages we have a situation where we have a tree (master) and table (table) whose data is partially based on what is selected in that tree. We use the following logic to determine what is selected in the tree to perform the query on the table.
    public static JUCtrlHierNodeBinding getTreeSelectedNode(RichTree tree) {
    JUCtrlHierNodeBinding node = null;
    if (tree != null) {
    Object oldRowKey = tree.getRowKey();
    try {
    RowKeySet selectedRowKeySet = tree.getSelectedRowKeys();
    if (selectedRowKeySet != null) {
    for (Object selectedRowKey : selectedRowKeySet) {
    tree.setRowKey(selectedRowKey);
    node = (JUCtrlHierNodeBinding)tree.getRowData();
    break;
    } finally {
    tree.setRowKey(oldRowKey);
    return node;
    I hooked up a beforePhase listener on my jspx to call this function and get the (previously - last time user was on this page) selected row and then refresh the table based on the selected tree row's data. This seems to work, but . . . in my log I'm seeing the following error. It seems like for some reason it's trying to convert my Raw UUID to an int, I have no idea why.
    <SortableModel> <_toRowIndex> Invalid rowkey:oracle.jbo.Key[B68F305BF7F5496D8A0FF99EE8F97CF0 ] type:class oracle.jbo.Key
    <SortableModel> <_toRowIndex>
    java.lang.ClassCastException: oracle.jbo.Key cannot be cast to java.lang.Integer
    at org.apache.myfaces.trinidad.model.SortableModel._toRowIndex(SortableModel.java:341)
    at org.apache.myfaces.trinidad.model.SortableModel.setRowKey(SortableModel.java:137)
    at org.apache.myfaces.trinidad.model.ChildPropertyTreeModel._setRowKey(ChildPropertyTreeModel.java:376)
    at org.apache.myfaces.trinidad.model.ChildPropertyTreeModel.setRowKey(ChildPropertyTreeModel.java:178)
    at org.apache.myfaces.trinidad.component.UIXCollection.setRowKey(UIXCollection.java:425)
    at oracle.apps.aia.sr.common.JSFUtils.getTreeSelectedNode(JSFUtils.java:392)
    So, I thought that maybe this wasn't the best way to get the selected node. So, after some research I changed the logic to be:
    public static JUCtrlHierNodeBinding getTreeSelectedNode(RichTree tree) {
    JUCtrlHierNodeBinding node = null;
    if (tree != null) {
    CollectionModel treeModel = (CollectionModel)tree.getValue();
    if (treeModel != null ){
    JUCtrlHierBinding treeBinding = (JUCtrlHierBinding)treeModel.getWrappedData();
    if (treeBinding != null){
    RowKeySet rks = tree.getSelectedRowKeys();
    if (rks != null){
    if (!rks.isEmpty()){
    List firstSet = (List)rks.iterator().next();
    node = treeBinding.findNodeByKeyPath(firstSet);
    return node;
    However, at the time of the beforePhase (I even tried an afterPhase listener) the tree isn't null, but the CollectionModel is null for some reason. I'm not sure where to go from here, any ideas?

    Hi,
    if you use lazy loading (contentdelivery="lazy" then the data is queried after the tree renders. ou would need to set it to immediate to acess data suring the Preparerender phase).
    Frank

  • Want to send selected nodes after transformation

    Hi,
    I am doing transformation and due to which all the nodes are taken in output even empty/null nodes too. I wan that only selected nodes will be in the output payload after transformation for e.g only mandatory and not null optional fields will be send. How can this be possible?
    -vivek

    How do you know what fields are "selected". Are you going to check them on payload to see if they're not null, and ifso, you assign them to the target? Or some other construction.
    Eitherway, i think can use the "test" condition in xsl to see what fields to map and what fields to skip. Or if you don't use xsl but just the assigns you need to some switch construnction in bpel to design what fields to map.

  • TreeView - Expand only selected node and collapse others

    Hi
    How I can expand only selected node and collapse other nodes that was expanded earlier?!

    Ghostenigma,
    switch Option Strict On. I've tried to analyze the code but it's not usable due to type ignorance.
    BTW, Goto is not required here. ELSEif means it's only executed if the previous expressions are not true.
    Armin
    Ignore other code and give an reply for what I've asked else you are not obligated to post a reply at all!
     I am not sure if you took the "type ignorance" part wrong but, Armin was only trying to give you helpful information which i would give too.  Option Strict is a GOOD thing to use and the GoTo statements are not needed inside your ElseIf
    statements.  As far as that goes, i would not recommend using GoTo in any modern .Net programming.
     Anyways, the problem is with the way you are Adding and Removing all the child nodes every time the nodes are DoubleClicked and when they are Collapsing.  I just simulated your code to add the sub nodes when a main node is double clicked. 
    You can just use the NodeMouseDoubleClick event instead of the TreeView`s DoubleClick event to make it a little easier on yourself too.
     This corrected the problem for me.
    Public Class Form1
    Private r As New Random ' this random class is only for my simulation of adding sub nodes (not needed)
    Private expanded As TreeNode
    Private Sub TreeView1_BeforeCollapse(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeCollapse
    e.Node.Nodes.Clear()
    End Sub
    Private Sub TreeView1_BeforeExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeExpand
    Dim pn As TreeNode = e.Node
    While pn.Parent IsNot Nothing
    pn = pn.Parent
    End While
    If expanded IsNot Nothing And expanded IsNot pn Then expanded.Collapse()
    expanded = pn
    End Sub
    Private Sub TreeView1_NodeMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseDoubleClick
    'Added this part to collapse the prior expanded node and set the (expanded) node to the new one
    If expanded IsNot Nothing And expanded IsNot e.Node Then
    expanded.Collapse()
    Dim pn As TreeNode = e.Node
    While pn.Parent IsNot Nothing
    pn = pn.Parent
    End While
    expanded = pn
    End If
    'This just simulates your code to add the new sub nodes to the main node that was double clicked
    'you need to put your code here instead of this.
    Dim str() As String = {"one.mp3", "Two.mp4", "Three.mvk"}
    Dim s As String = str(r.Next(0, 3))
    e.Node.Nodes.Add(s, s)
    e.Node.Expand()
    End Sub
    End Class
     PS - I notice you are adding more and more Images to your ImageList every time you double click on a node.  If you just add the Images to it once when the app is loading then you can just use the Image Key to set the correct Image to the newly
    added node.
    If you say it can`t be done then i`ll try it

  • Editing xsl:variable node

    I want to write a java class that edits the value of the playerNumber variable in player.xsl. I wrote the java class below but the line with XPathQuery.selectSingleNode returns null. I thought my query would work but now I think maybe the problem is that I'm not specifying a namespace in my query. Anyone have any helpful hints? Thanks in advance.
    TransformXSL.java
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import java.io.*;
    public class TransformXSL {
         public static void main(String[] args) throws Exception {
              File fl = new File ("player.xsl");
               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document doc = builder.parse(fl);
              Element docElement = doc.getDocumentElement();
              String xpathQuery = "xsl:stylesheet/xsl:variable";
              Node n = XPathAPI.selectSingleNode(docElement, xpathQuery); // this node returns null
              if (n == null) {
                   System.out.println("n is null");
              } else {
                   System.out.println("n is not null");
    player.xsl
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
         <xsl:variable name="playerNumber">25</xsl:variable>
         <xsl:template match="/">
              <h3>
                   <xsl:value-of select="firstName"/>
                   <xsl:value-of select="lastName"/>
                   <xsl:value-of select="$playerNumber"/>
              </h3>
         </xsl:template>
    </xsl:stylesheet>

    Witht the XPathAPI a namespace node is required in the selectSingleNode method for a node with a namespace prefix.
    Parse with the JDOM XPath class which has a addNamespace method to add namespace for XPath expressions.
    http://www.jdom.org/docs/apidocs/org/jdom/xpath/XPath.html

  • ACS 5.3 - 11033 Selected Service type is not Network Access

    I have some older devices on the network that only support RADIUS (not TACACS) for authentication and would like to have them use SecureACS 5.3 
    I understand that by default, ACS only supports TACACS for device administration.  So I'll get this error when trying RADIUS:
    11033 Selected Service type is not Network Access
    Description:
    RADIUS requests can only be processed by Access Services that are of type Network Access
    Resolution Text:
    Verify that the Service Selection Policy rules are correct
    However, even after adjusting the Service Selection rules and seeing hits, I still see the same message in the logs, as if it has no affect.  Any Ideas?

    If you use the protocol as radius you can not use a device admin service. You can only use network access. That will allow you for authentication to the devices.
    Regards,
    Amjad
    Rating useful replies is more useful than saying "Thank you"

  • Report MB5B for selected movement types

    Dear All,
    When I am executing report for selected movement types , system givivng me message below " Movment type is reset"
    After continuing that Movement type field turns BLANK, and report is executed with considering all movement types.
    If there is a way for executing MB5B report for selected movement types, please suggest.
    Thanx..

    Hai,
    1.The MB5B report will show the stock on posting date with all movements like Goods recipt from Purchase, production order, stock transport order, & goods issue due to consumption posting, stock transfers & transfer posting.
    2. This is designed to see the Opening balane+Goods receipt - goods issue = closing balance.
    3.You can't take report only for particulat movement type.
    4.If u want to get the details as per the movement type, then use MB51 report.

  • How do I get PS CS5 to stop freezing when I select the type tool?

    Okay, I've read the other threads about photoshop cs5 freezing up for various reasons. I'm running it on os x 10.5.8 on a dual quad 2.8 processor tower. Every time I open PS and select the type tool, my entire computer slows and freezes to the point I have to do a hard restart. I've tried disabling all fonts and the same things happens (though when they're all disabled I do get a text cursor before things hang up). I'm looking for any advice--I spend the entire day today trying to fix this.

    Chris, I tried updating and it wouldn't install... Are you not allowed to install updates when you are using the "trial version"?
    I sure would like to get this resolved before investing in the actual purchase of CS5. I always get the Master Collection and it's expensive.
    So, if I can't install the update and try and find a fix to the issue, I don't think I'd be comfortable purchasing... you know?
    That's why I ALWAYS download the trial version first... to see if there are issues before buying!
    Anyway... I'll keep my eye on these posts to see if this has been cleared up... then, I'll buy.
    But, thanks very much for your help and feedback to my question and concern.
    appreciate it!

  • How to get the selected node value of a tree which is build on java code

    Hi Experts,
    How can i get the selected node value if I build the tree programatically.
    I am using the following code in selectionListener but it is throwing error.
    RichTreeTable treeTable = (RichTreeTable)getQaReasontreeTable();
    CollectionModel _tableModel =
    (CollectionModel)treeTable.getValue();
    RowKeySet _selectedRowData = treeTable.getSelectedRowKeys();
    Iterator rksIterator = _selectedRowData.iterator();
    String selectedQaCode ="";
    while (rksIterator.hasNext()) {
    List key = (List)rksIterator.next();
    JUCtrlHierBinding treeTableBinding =
    (JUCtrlHierBinding)((CollectionModel)treeTable.getValue()).getWrappedData();
    JUCtrlHierNodeBinding nodeBinding =
    treeTableBinding.findNodeByKeyPath(key);
    String nodeStuctureDefname =
    nodeBinding.getHierTypeBinding().getStructureDefName();
    selectedQaCode = selectedQaCode + nodeBinding.getAttribute(0);
    where I am using following link to create a tree with java code.
    http://one-size-doesnt-fit-all.blogspot.com/2007/05/back-to-programming-programmatic-adf.html
    Please help me in resolving this issue.
    Regards
    Gayaz

    Hi,
    you should also move
    JUCtrlHierBinding treeTableBinding =
    (JUCtrlHierBinding)((CollectionModel)treeTable.getValue()).getWrappedData();
    out of the while loop as this is not necessary to be repeated for each key in the set
    Frank

Maybe you are looking for

  • All the functions under file are not working. I cannot save as image, I cannot save, etc

    All of a sudden, I cannot "save as other" or "save" I cannot open a new file. I can print. I can use feature "get document signed". When I click on any of those non-working features, nothing happens. In save as other, the drop down menu opens but if

  • Has anyone successfully used the serial-over-lan feature in ipmitool?

    The IPMI hardware in Apple's Intel Xserves ostensibly supports serial-over-LAN access via ipmitool. Attempting to access it with ipmitool doesn't appear to work, however; the command ipmitool -H hostname -U username sol activate simply returns withou

  • Ravaluation of  P&L account

    Hi All, Is it necessary to revaluate the P&L account eg: for Intrest on Loan where  items are posted in foreign currency does it necessary that we have revaluate this account for month end process. Or only balance sheet account are valauted ? plz adv

  • Reading IMSI in the GSM CARD.

    Sorry All ... but I stard a new topic on one of my old subject. Hi everybody ... Acutally I try to read the IMSI (serial number of a gsm sim card), I've moved to the JAVA 1.6 release, because AFAIK, the is the only version that support smartcard I/O.

  • TOC Conditional Build Tags

    I am considering upgrading from Robohelp version X5 to version 7. I was actually really interested in the feature offered by version 6 that would allow conditional build tags to be assigned to TOC entries. Is this feature available in version 7 also?