Search Results

Search found 2725 results on 109 pages for 'nodes'.

Page 16/109 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • How do I de-duplicate a list of nodes in XSLT - and return the last node encountered?

    - by Broam
    I've seen lots of "de-duplicate this xml" questions but everyone wants the first node or the nodes are identical. I have a bit of a bigger puzzle. I have a list of articles in XML, a relevant snippet is shown: <item><key>Article1</key><stamp>100</stamp></item> <item><key>Article1</key><stamp>130</stamp></item> <item><key>Article2</key><stamp>800</stamp></item> <item><key>Article1</key><stamp>180</stamp></item> <item><key>Article3</key><stamp>900</stamp></item> <item><key>Article3</key><stamp>950</stamp></item> <item><key>Article4</key><stamp>990</stamp></item> <item><key>Article5</key><stamp>999</stamp></item> I'd like a list of nodes where the keys are unique and where the last instance is returned, not the first: Stamp (integer) is always increasing for elements of a particular key. Ideally I'd like "largest stamp" but they're always in order so the shortcut is ok. Desired result: (Order doesn't really matter.) <item><key>Article2</key><stamp>800</stamp></item> <item><key>Article1</key><stamp>180</stamp></item> <item><key>Article3</key><stamp>950</stamp></item> <item><key>Article4</key><stamp>990</stamp></item> <item><key>Article5</key><stamp>999</stamp></item> I'm somewhat confused on how to get this list. Any ideas? I'm using the Saxon processor if it matters.

    Read the article

  • Adding <span> tags to all text nodes between custom self closing tags.

    - by Rachel
    I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. The s1 tag has an attribute 'styleName' which needs to be copied as the class name for the span tags populated for the s1,s2 pair. Within a s1, s2 tag pair, other s1, s2 tags can occur. It is the id attribute of the tags s1 and s2 that help us to find the postion from where we need to start populating the span(for text nodes alone) and the end where we need to stop. In case of common text nodes that is part of the multiple s1, s2 pairs then the span tags needs to be opened and closed appropirately as shown in the sample below. I am not specific with the format of the id populated for the span tag. Along as it is unique it is fine. Can we achive this kind of a solution using XSL. I am using Saxon processor. Sample input: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <x:s1 id="1" styleName="name_1"/>is my <x:s2 id="1" />heading</h1> <p> Sample content <x:s1 id="2" styleName="name_2"/> Some text here. </p> <p> Here you <x:s2 id="2" />go. </p> <p> <x:s1 id="3" styleName="name_3"/>This <x:s1 id="4" styleName="name_4"/>is just a simple text <x:s2 id="4" />Some text here.<x:s2 id="3" /> Some content here. </p> <p> Use this <x:s1 id="5" styleName="name_5"/>space. </p> <p> Indroducing <x:s1 id="6" styleName="name_6"/> more information. </p> <p> Can add some <x:s2 id="6" />more content here. </p> <p> Sample content <x:s2 id="5" />Some text here. Some content here. </p> <p> <x:s1 id="7" styleName="name_7"/>This is a complex data. <x:s1 id="8" styleName="name_8"/>Framing a long sentence to <x:s2 id="7" />accomodate all possible <x:s2 id="8" />scenarios. </p> <p> <x:s1 id="9" styleName="name_9"/>More data can be <x:s1 id="10" styleName="name_10"/>added here. </p> <p> Trying to include here. </p> <p> Modifying <x:s2 id="9" />content <x:s2 id="10" />here. </p> </body> </html> Sample output: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1_1" class="name_1">is my </span>heading</h1> <p> Sample content <span id="2_1" class="name_2"> Some text here.</span> </p> <p> <span id="2_2" class="name_2">Here you </span>go. </p> <p> <span id="3_1" class="name_3">This <span id="4_1" class="name_4">is just a simple text </span>Some text here.</span> Some content here. </p> <p> Use this <span id="5_1" class="name_5">space.</span> </p> <p> <span id="5_2" class="name_5">Indroducing <span id="6_1" class="name_6"> more information.</span></span> </p> <p> <span id="5_3" class="name_5"><span id="6_2" class="name_6">Can add some </span>more content here.</span> </p> <p> <span id="5_4" class="name_5">Sample content </span>Some text here. Some content here. </p> <p> <span id="7_1" class="name_7">This is a complex data.</span> <span id="8_1" class="name_8"><span id="7_2" class="name_7">Framing a long sentence to </span></span><span id="8_2" class="name_8">accomodate all possible </span>scenarios. </p> <p> <span id="9_1" class="name_9">More data can be <span><span id="10_1" class="name_10"><span id="9_2" class="name_9">added here.</span></span> </p> <p> <span id=10_2 class="name_10"><span id="9_3" class="name_9">Trying to include here.</span></span> </p> <p> <span id=10_3 class="name_10"><span id="9_4" class="name_9">Modifying</span></span><span id="10_4" class="name_10">content </span>here. </p> </body> </html> Thanks.

    Read the article

  • Adding <span> tags to all text nodes between custom self closing tags.

    - by Rachel
    I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. The s1 tag has an attribute 'styleName' which needs to be copied as the class name for the span tags populated for the s1,s2 pair. Within a s1, s2 tag pair, other s1, s2 tags can occur. It is the id attribute of the tags s1 and s2 that help us to find the postion from where we need to start populating the span(for text nodes alone) and the end where we need to stop. In case of common text nodes that is part of the multiple s1, s2 pairs then the span tags needs to be opened and closed appropirately as shown in the sample below. I am not specific with the format of the id populated for the span tag. As long as it is unique it is fine. Can we achieve this kind of a solution using XSL. I am looking for a XSL based solution for the same. I am using Saxon java processor for XSL. I am trying to achieve this using XSL 2.0. Please share your ideas on this. EDIT: I have edited my sample input and output to make my question more clear. Sample input: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <x:s1 id="1" styleName="name_1"/>is my <x:s2 id="1" />heading</h1> <p> Sample content <x:s1 id="2" styleName="name_2"/> Some text here. </p> <p> Here you <x:s2 id="2" />go. </p> <p> <x:s1 id="3" styleName="name_3"/>This <x:s1 id="4" styleName="name_4"/>is just a simple text <x:s2 id="4" />Some text here.<x:s2 id="3" /> Some content here. </p> <p> Use this <x:s1 id="5" styleName="name_5"/>space. </p> <p> Indroducing <x:s1 id="6" styleName="name_6"/> more information. </p> <p> Can add some <x:s2 id="6" />more content here. </p> <p> Sample content <x:s2 id="5" />Some text here. Some content here. </p> <p> <x:s1 id="7" styleName="name_7"/>This is a complex data. <x:s1 id="8" styleName="name_8"/>Framing a long sentence to <x:s2 id="7" />accomodate all possible <x:s2 id="8" />scenarios. </p> <p> <x:s1 id="9" styleName="name_9"/>More data can be <x:s1 id="10" styleName="name_10"/>added here. </p> <p> Trying to include here. </p> <p> Modifying <x:s2 id="9" />content <x:s2 id="10" />here. </p> </body> </html> Sample output: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1_1" class="name_1">is my </span>heading</h1> <p> Sample content <span id="2_1" class="name_2"> Some text here.</span> </p> <p> <span id="2_2" class="name_2">Here you </span>go. </p> <p> <span id="3_1" class="name_3">This <span id="4_1" class="name_4">is just a simple text </span>Some text here.</span> Some content here. </p> <p> Use this <span id="5_1" class="name_5">space.</span> </p> <p> <span id="5_2" class="name_5">Indroducing <span id="6_1" class="name_6"> more information.</span></span> </p> <p> <span id="5_3" class="name_5"><span id="6_2" class="name_6">Can add some </span>more content here.</span> </p> <p> <span id="5_4" class="name_5">Sample content </span>Some text here. Some content here. </p> <p> <span id="7_1" class="name_7">This is a complex data.</span> <span id="8_1" class="name_8"><span id="7_2" class="name_7">Framing a long sentence to </span></span><span id="8_2" class="name_8">accomodate all possible </span>scenarios. </p> <p> <span id="9_1" class="name_9">More data can be <span><span id="10_1" class="name_10"><span id="9_2" class="name_9">added here.</span></span> </p> <p> <span id=10_2 class="name_10"><span id="9_3" class="name_9">Trying to include here.</span></span> </p> <p> <span id=10_3 class="name_10"><span id="9_4" class="name_9">Modifying</span></span><span id="10_4" class="name_10">content </span>here. </p> </body> </html> Thanks.

    Read the article

  • How do I display many images (by imagefield) in all my nodes of a type?

    - by Leon
    The thing is that I have hundreds of nodes each with 4 to 12 images all of them around the same size in an imagefield but I want to order that so it looks at the end in a grid or something like that. I know that panels and views are the answer but I think I've seen all of the tutorials available but nothing. If anyone know where can I find something like I need, I'll be very gratefull.

    Read the article

  • How to modify preorder tree traversal algorithm to handle nodes with multiple parents?

    - by poldo
    I've been searching for a while now and can't seem to find an alternative solution. I need the tree traversal algorithm in such a way that a node can have more than 1 parent, if it's possible (found a great article here: Storing Hierarchical Data in a Database). Are there any algorithms so that, starting from a root node, we can determine the sequence and dependencies of nodes (currently reading topological sorting)?

    Read the article

  • drupal : How to set separate editing template files for each nodes ?

    - by Thomas John
    Hello guys I have a 3 page drupal(6.20) site, each page has its own template like page-node-1.tpl.php, page-node-2.tpl.php, page-node-3.tpl.php, I would like to set separate templates when editing each node, I tried page-node-1-edit.tpl.php but its not working, but page-node-edit.tpl is working, but its common to all nodes, I need separate editing templates for each node like page-node-1-edit.tpl.php and page-node-2-edit.tpl.php Thanks a lot for your time

    Read the article

  • Methods for implementing and using graphs of nodes in C++?

    - by DistortedLojik
    I am working on a research project that deals with social networks. I have done most of the backbone of the program in C++ and am now wanting to implement a way to create the graph of nodes and the connections as well as a way to visualize the connections between people. I have looked a little into Lemon and the Boost graph library, but was wondering which one would be easier to learn and implement or if I should just code my own.

    Read the article

  • Cassandra replication system - how it works

    - by inquisitor
    Does cassandra replicates only on write procedure (with choosen consistency level)? Is there any auto-replicate option for absent nodes, if i want symetric data in every node? If I plug in new node to cluster there is no auto replication - how to sync data from others nodes with new one? If I want replication like multimaster (2 nodes) with slave backup (1 node) known from MySQL, what is the proper logic setup and manage that on cassandra (3 nodes)? How about two nodes?

    Read the article

  • Possible to set two values for two different nodes from user input in XForms?

    - by iHeartGreek
    Hi! I would like to set two values for two different nodes from user input in XForms. I am curious about how this is done, if at all possible. For example, if I have the following data model: <xf:instance id="criteria_data" xmlns=""> <criteria> <set> <root></root> <criterion></criterion> </set> </criteria> </xf:instance> <xf:instance id="choices" xmlns=""> <choices> <root label="The Choices">/AAA</root> <choice label="BBB">/@BBB</choice> </choices> </xf:instance> <xf:instance id="choices" xmlns=""> <choices> <root>/AAA</root> <choice label="BBB">/@BBB</choice> <choice label="CCC">/@CCC</choice> <choices> </xf:instance> <xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/set/criterion"/> <xf:bind id="data_root" nodeset="instance('criteria_data')/criteria/set/root"/> <xf:bind id="choices_root" nodeset="instance('choices')/root"/> <xf:bind id="choices" nodeset="instance('choices')/choice"/> and my ui code looks like: <xf:select bind="data_criterion" appearance="full"> <xf:label>Your choices:</xf:label> <xf:itemset bind="choices"> <xf:label ref="@label"></xf:label> <xf:value ref="."></xf:value> </xf:itemset> </xf:select> But I essentially want it to be like this (though this is invalid and does not produce any xml at all): <xf:select appearance="full"> <xf:label>Your choices:</xf:label> <xf:itemset bind="choices"> <xf:label ref="@label"></xf:label> <xf:value bind="data_criterion" ref="."></xf:value> <xf:value bind="data_root" ref="instance('choices')/root"></xf:value> </xf:itemset> </xf:select> The XML output I want to achieve (if user checks "BBB"): <criteria> <set> <root>/AAA</root> <criterion>/@BBB</criterion> </set> </criteria> How can I achieve setting these two nodes for the one checkbox seletion? Hope that all made sense... Thanks! :)

    Read the article

  • How to use XSLT to tag specific nodes with unique, sequential, increasing integer ids?

    - by ~otakuj462
    Hi, I'm trying to use XSLT to transform a document by tagging a group of XML nodes with integer ids, starting at 0, and increasing by one for each node in the group. The XML passed into the stylesheet should be echoed out, but augmented to include this extra information. Just to be clear about what I am talking about, here is how this transformation would be expressed using DOM: states = document.getElementsByTagName("state"); for( i = 0; i < states.length; i++){ states.stateNum = i; } This is very simple with DOM, but I'm having much more trouble doing this with XSLT. The current strategy I've devised has been to start with the identity transformation, then create a global variable which selects and stores all of the nodes that I wish to number. I then create a template that matches that kind of node. The idea, then, is that in the template, I would look up the matched node's position in the global variable nodelist, which would give me a unique number that I could then set as an attribute. The problem with this approach is that the position function can only be used with the context node, so something like the following is illegal: <template match="state"> <variable name="stateId" select="@id"/> <variable name="uniqueStateNum" select="$globalVariable[@id = $stateId]/position()"/> </template> The same is true for the following: <template match="state"> <variable name="stateId" select="@id" <variable name="stateNum" select="position($globalVariable[@id = $stateId])/"/> </template> In order to use position() to look up the position of an element in $globalVariable, the context node must be changed. I have found a solution, but it is highly suboptimal. Basically, in the template, I use for-each to iterate through the global variable. For-each changes the context node, so this allows me to use position() in the way I described. The problem is that this turns what would normally be an O(n) operation into an O(n^2) operation, where n is the length of the nodelist, as this require iterating through the whole list whenever the template is matched. I think that there must be a more elegant solution. Altogether, here is my current (slightly simplified) xslt stylesheet: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.w3.org/2005/07/scxml" xmlns="http://www.w3.org/2005/07/scxml" xmlns:c="http://msdl.cs.mcgill.ca/" version="1.0"> <xsl:output method="xml"/> <!-- we copy them, so that we can use their positions as identifiers --> <xsl:variable name="states" select="//s:state" /> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="s:state"> <xsl:variable name="stateId"> <xsl:value-of select="@id"/> </xsl:variable> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:for-each select="$states"> <xsl:if test="@id = $stateId"> <xsl:attribute name="stateNum" namespace="http://msdl.cs.mcgill.ca/"> <xsl:value-of select="position()"/> </xsl:attribute> </xsl:if> </xsl:for-each> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> I'd appreciate any advice anyone can offer. Thanks.

    Read the article

  • In SQL Server can I insert multiple nodes into XML from a table?

    - by tpower
    I want to generate some XML in a stored procedure based on data in a table. The following insert allows me to add many nodes but they have to be hard-coded or use variables (sql:variable): SET @MyXml.modify(' insert <myNode> {sql:variable("@MyVariable")} </myNode> into (/root[1]) ') So I could loop through each record in my table, put the values I need into variables and execute the above statement. But is there a way I can do this by just combining with a select statement and avoiding the loop? Edit I have used SELECT FOR XML to do similar stuff before but I always find it hard to read when working with a hierarchy of data from multiple tables. I was hoping there would be something using the modify where the XML generated is more explicit and more controllable.

    Read the article

  • ASP.NET treeview populate child nodes. How can I avoid a postback to server?

    - by mas_oz2k1
    I am trying to test populate on demand for a treeview. I follow the procedure from these links: http://msdn.microsoft.com/en-us/library/e8z5184w.aspx But the treeview still make a postback to the server if I expanded one of the tree nodes (If you put a breakpoint in the first line of Page_load event), thus refreshing the whole page. I am using VS2005 and Asp.net 2.0 (but the same issue occurs in VS2008) My simple test page markup is: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="aspTreeview.aspx.cs" Inherits="aspTreeview" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td style="height: 80%; width: 45%;"> <asp:Panel ID="Panel1" runat="server" BorderColor="#0033CC" BorderStyle="Solid" ScrollBars="Both"> <asp:TreeView ID="TreeView1" runat="server" ShowLines="True" PopulateNodesFromClient="True" EnableClientScript="True" NodeWrap="True" ontreenodepopulate="TreeView1_TreeNodePopulate" ExpandDepth="0"> </asp:TreeView> </asp:Panel> </td> <td style="width: 10%; height: 80%;" > <div> <asp:Button ID="Button1" runat="server" Text="->" onclick="Button1_Click" /> </div> <div> <asp:Button ID="Button2" runat="server" Text="<-" /> </div> </td> <td style="width: 136px; height: 80%"> <asp:Panel ID="Panel2" runat="server" BorderColor="Lime" BorderStyle="Solid"> <asp:TreeView ID="TreeView2" runat="server" ShowLines="True" ExpandDepth="0"> </asp:TreeView> </asp:Panel> </td> </tr> <tr> <td> </td> <td> </td> <td style="width: 136px"> </td> </tr> </table> </div> </form> </body> </html> The code behind is: protected void Page_Load(object sender, EventArgs e) { Debug.WriteLine("Page_Load started."); if (!IsPostBack) { if (Request.Browser.SupportsCallback) Debug.WriteLine("Browser supports callback scripts."); for (int i = 0; i < 3; i++) { TreeNode node = new TreeNode("ENTRY " + i.ToString()); node.Value = i.ToString(); node.PopulateOnDemand = true; node.Expanded = false; TreeView1.Nodes.Add(node); } } Debug.WriteLine("Page_Load finished."); } protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e) { TreeNode targetNode = e.Node; for (int j = 0; j < 4200; j++) { TreeNode subnode = new TreeNode(String.Format("Sub ENTRY {0} {1}", targetNode.Value, j)); subnode.PopulateOnDemand = true; subnode.Expanded = false; targetNode.ChildNodes.Add(subnode); } }

    Read the article

  • Erlang: How to view output of io:format/2 calls in processes spawned on remote nodes.

    - by jkndrkn
    Hello, I am working on a decentralized Erlang application. I am currently working on a single PC and creating multiple nodes by initializing erl with the -sname flag. When I spawn a process using spawn/4 on its home node, I can see output generated by calls io:format/2 within that process in its home erl instance. When I spawn a process remotely by using spawn/4 in combination with register_name, output of io:format/2 is sometimes redirected back to the erl instance where the remote spawn/4 call was made, and sometimes remains completely invisible. Similarly, when I use rpc:call/4, output of io:format/2 calls is redirected back to the erl instance where the `rpc:call/4' call is made. How do you get a process to emit debugging output back to its parent erl instance?

    Read the article

  • How to optimize Dijkstra algorithm for a single shortest path between 2 nodes?

    - by Nazgulled
    Hi, I was trying to understand this implementation in C of the Dijkstra algorithm and at the same time modify it so that only the shortest path between 2 specific nodes (source and destination) is found. However, I don't know exactly what do to. The way I see it, there's nothing much to do, I can't seem to change d[] or prev[] cause those arrays aggregate some important data for the shortest path calculation. The only thing I can think of is stopping the algorithm when the path is found, that is, break the cycle when mini = destination when it's being marked as visited. Is there anything else I could do to make it better or is that enough? P.S: I just noticed that the for loops start at 1 until <=, why can't it start at 0 and go until <?

    Read the article

  • Check which nodes of Beowulf HPC cluster system are free from PHP app?

    - by Skuja
    I am working on my diploma thesis project. I have access to 32Node Dell poweredge HPC cluster system with Linux(Debian i think) installed on it. My first goal is to create web (PHP) app where logged users could see free and busy nodes, turn them on and off. I am planning to do something like this - write some cron daemon that would run every 30seconds or other interval, and it could run ping utility for each node to find out if it is on or off, then write results to some file. Then from my web app i could read the info. Will it be a good solution? What existing for node management solutions are there?

    Read the article

  • How do I make a view that groups nodes by taxonomy term?

    - by Andrew Weir
    Hello, I'm trying to bend views and drupal to my will. So far I've produced a view to display the titles of my nodes. Each node will be assigned exactly one taxonomy term from the set {X, Y and Z}. So for example, Node A has a title "Car drives into field, thousands don't care". Node A has a taxonomy term "Pointless". I'd like to group all the node titles by their taxonomy term. So.. Pointless - Car drives into field, thousands don't care - .... Next Taxonomy Term - ..... - ...... - ... You get the idea. Is it doable and how do I do it? I can't find the group by option in views. cheers SO.

    Read the article

  • Can anyone help with java? Finding common nodes from two linked lists using recursion

    - by Dan
    I have to write a method that returns a linked list with all the nodes that are common to two linked lists using recursion, without loops. For example, first list is 2 - 5 - 7 - 10 second list is 2 - 4 - 8 - 10 the list that would be returned is 2 - 10 I am getting nowhere with this.. What I have been think of was to check each value of the first list with each value of the second list recursively but the second list would then be cut by one node everytime and I cannot compare the next value in the first list with the the second list. I hope this makes sense... Can anyone help?

    Read the article

  • Using Dom Objects in PHP, the default namespace is redeclared in some nodes.

    - by TomcatExodus
    I'm working on a template engine, having migrated from regex driven to DOM driven. It appears though, that whenever I create a DomDocumentFragment to encapsulate some portion of a document temporarily, the namespace attribute is added to each node in the fragment. Since my default namespace for a given document will 99% of the time be XHTML, it's adding the XHTML namespace declaration. Being the default namespace, this seems fruitless, and ultimately nodes in any other namespace will be stripped out at render time anyways. Aside from iteratively removing namespace attributes, is there some way I can prevent this from occurring to begin with? Its quite problematic, as this will likely increase render time filesize considerably, as large portions of a given document may be stored in a fragment. I've tried $doc->normalizeDocument(), but as I assumed, it did nothing.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >