How do I calculate/retrieve the depth of a current node in XSLT?
I mean the number of parent nodes a particular node has, hard coded something like:
<root>
<child depth="1">
<another_child depth="2">
I do not want to hard code these levels, so i am searching for a way to do it in XSLT. I could not find a function/element for this purpose.
Who knows the solution????
tnx
You count the nodes in the ancestor axis: something like count(ancestor:*). Adjust by +/-1 if you need to include/exclude the root or the current node.
Similar Messages
-
Loaded iPhoto 9.2, my 7200 photos grew to 113,000 files with screen shots, duplicates, ,5-10copies of faces and apple has no way to eliminate this. How can I ever retrieve the original 7200 from this mess?
This can happen if the HD icon is inadvertently dragged to the iPhoto Window.
Easiest solution: restore from your back up.
Regards
TD -
HT201401 How to reset or retrieve the restriction password
I have forgotten my restriction password how to reset or retrieve the password
No, if you do not believe me, read the manual or google it for yourself.
-
How can an applet retrieve the values of a HTML form shown in a JEditorPane
Hi,
I'm doing an applet that contains a JTree and a JEditorPane
among other components. Each node of the JTree represents some
information that is stored in a database, and whenever a JTree
node is selected, this information is recovered and shown in
the JEditorPane with a html form. To make the html form,
the applet calls a servlet, which retrieves the information of
the node selected from the database. This information is stored
like a XML string, and using XSLT, the servlet sends the html
form to the applet, which shows it in the JEditorPane.
My problem is that I don't know how I can recover new values
that a user of the application can introduce in the input fields
of the html form. I need to recover this new values and send them
to another servlet which store the information in the database.
If someone could help me I'd be very pleased.
EduardoAt least I found a fantastic example. Here it is:
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
public class FormSubmission extends JApplet {
private final static String FORM_TEXT = "<html><head></head><body><h1>Formulario</h1>"
+ "<form action=\"\" method=\"get\"><table><tr><td>Nombre:</td>"
+ "<td><input name=\"Nombre\" type=\"text\" value=\"James T.\"></td>"
+ "</tr><tr><td>Apellido:</td>"
+ "<td><input name=\"Apellido\" type=\"text\" value=\"Kirk\"></td>"
+ "</tr><tr><td>Cargo:</td>"
+ "<td><select name=\"Cargo\"><option>Captain<option>Comandante<option>General</select></td>"
+ "</tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Enviar\"></td>"
+ "</tr></table></form></body></html>";
protected HashMap radioGroups = new HashMap();
private Vector v = new Vector();
public FormSubmission() {
getContentPane().setLayout(new BorderLayout());
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
editorPane.setEditorKit(new HTMLEditorKit()
public ViewFactory getViewFactory() {
return new HTMLEditorKit.HTMLFactory() {
public View create(Element elem) {
Object o = elem.getAttributes().getAttribute(javax.swing.text.StyleConstants.NameAttribute);
if (o instanceof HTML.Tag)
HTML.Tag kind = (HTML.Tag) o;
if (kind == HTML.Tag.INPUT || kind == HTML.Tag.SELECT || kind == HTML.Tag.TEXTAREA)
return new FormView(elem)
protected void submitData(String data)
showData(data);
protected void imageSubmit(String data)
showData(data);
// Workaround f�r Bug #4529702
protected Component createComponent()
if (getElement().getName().equals("input") &&
getElement().getAttributes().getAttribute(HTML.Attribute.TYPE).equals("radio"))
String name = (String) getElement().getAttributes().getAttribute(HTML.Attribute.NAME);
if (radioGroups.get(name) == null)
radioGroups.put(name, new ButtonGroup());
((JToggleButton.ToggleButtonModel) getElement().getAttributes().getAttribute(StyleConstants.ModelAttribute)).setGroup((ButtonGroup) radioGroups.get(name));
JComponent comp = (JComponent) super.createComponent();
// Peque�a mejora visual
comp.setOpaque(false);
return comp;
return super.create(elem);
//editorPane.setText(FORM_TEXT);
editorPane.setText(texto);
getContentPane().add(new JScrollPane(editorPane), BorderLayout.CENTER);
private void showData(String data) {
// ergebnis significa resultado
StringBuffer ergebnis = new StringBuffer("");
StringTokenizer st = new StringTokenizer(data, "&");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String key = URLDecoder.decode(token.substring(0, token.indexOf("=")));
String value = URLDecoder.decode(token.substring(token.indexOf("=")+1,token.length()));
v.add(value);
ergebnis.append(" "); ergebnis.append(key); ergebnis.append(": "); ergebnis.append(value); ergebnis.append(" ");
ergebnis.append(" ");
JOptionPane.showMessageDialog(this, ergebnis.toString());
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame ();
FormSubmission editor = new FormSubmission ();
frame.getContentPane().add(editor);
frame.pack();
frame.show();
} -
How come I cannot retrieve the note contents in the Notes Folder
I was able to read the contents in the NOTES FOLDER yesterday morning. But by noon time when I tried to retrieve some infor from the NOTES Folder, the folder was 'BLANK" and then went off.
Pls advise what happen and how to retrieve the contents in the Notes Folder.What codec did you use?
Did you field-render? If so, are your fields interpreted correctly?
Are you working in a particular color space? -
When opening new tab, how do I get/add the thumbnail page instead of blank page.
Hm, I was referring to this one:
https://support.cdn.mozilla.net/media/uploads/gallery/images/2012-05-16-12-04-59-4ca3a3.png
You may also try this solution if the button is not there:
''Type '''about:config''' into address bar, press Enter. Accept the warning. Search for '''browser.newtabpage.enabled''', right click it, and press Reset. Then search for '''browser.newtab.url''', right click it, and press Reset. ''
Also some tips on using New Tab Page can be found here:
https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites
I hope this time the solution will help you! -
Is there any way that I can programmatically retrieve the CVI Target Version Settings (e.g. File Version, Copyright, etc) in my CVI application?
I am using LabWindows/CVI version 7.0.
The settings that I'd like to retrieve within my application are those that are set under Build | Target Settings... | Version Info...
e.g.
File Version
Product Version
Company Name
Legal Copyright
Thanks,
Darren
Message Edited by Darren Draper on 01-16-2006 02:03 AMWell, "File access permission denied" claims for an authorization problem . I suggest you double check file attributes in the project directory: it could be that you have downloaded this example from a CD and the read-only attribute has not been cleared.
The library does not reside in the example folder: as you can see by selecting View >> Show full pathnames in the project window, it should be in ....CVI\sdk\lib folder.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
How to update and retrieve the table control entries and field entries.
Hello everyone,
i have a requirement,
i have company code , plant, fiscal year, posting period fields in the selection screen and then below that i have a table control which contains 4 fields invoice no., check number, check date and amount.
i have to enter the values and when i press SAVE button , these values have to update in a custom table which i had created.
please send me the coding how to do this object.
will be rewarded.
thanks in advance.Hi Suresh
this is actual requirement
in the CAT2.
1. Add a new column for WBS description and derive the value as per the FS
2. Retrieve project number and description and update in the column specified
3. When a service order is selected it should do the same for 2.
4. Finally repeat for the worklist view (which is the section above)
here i am able to display values at data entry area
for service order and network but not worklist area ?
updation is not coming, can u plz go throw it..
Thanks
Chinna -
somehow my history was set to private by another user and now I need to find out how to restore this info for the days that it was set to private . there was very important sites that I had went and now my hdd crashed and i no longer have them stored what do i do ?
In PB mode data is only kept in memory by Firefox and not saved to disk, so an undelete utility like Recuva won't help. It is possible that your firewall keeps a log of visited websites, so you can take a look there.
-
How to set and retrieve the http headers
I am adding one custom header "edmsversion" in my first page, it is visible in it but when the response is redirected to another jsp, my header is lost. In second page, it's not getting. I have copied my code below. Please help me.
My first Page
System.out.println("Jsp called successfully");
response.addHeader("edmsversion","1.2");
boolean isheader = response.containsHeader("edmsversion");
System.out.println("contains edmsversion header ..."+isheader);
response.sendRedirect("/TestHeaderResponse.jsp");
TestHeaderResponse.jsp
System.out.println("Test header response page called successfully");
String stringversion = request.getHeader("edmsversion");
out.println("edms version header : "+stringversion);
Enumeration headernames = request.getHeaderNames();
System.out.println("Headers---------");
while (headernames.hasMoreElements()){
String headername = (String)headernames.nextElement();
String headervalue = request.getHeader(headername);
System.out.println(headername+"----"+headervalue);
out.println("over");You are setting a response header, then telling the browser to make a new request to a different page. All headers sent from "My First Page" are discarded and only the new response headers from "TestHeaderResponse.jsp" are available to the browser.
Try using
getServletContext().getRequestDispatcher("/TestHeaderResponse.jsp").include();That should work I would think. You cannot use the forward() method of the requestDispatcher because you cannot have sent any output from the calling servlet when using forward(). If forwarding from a jsp, all data in the output buffer is cleared before the forward takes place I believe, so you would get the same problem. Hope that helps. -
How to retrieve the values from a LinkedList
Hello,
I have just put this question in java programming forums by mistake...I think that it should be here ...
I have created a LinkedList to store the results of a query to a database.
These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
Here is an extract of my code in a jsp page.
LinkedList Average = new LinkedList();
String Media = rst.getString(10);
Average.add(Media);
int Size = Average.size();
double Sum = 0.0;
for (int i=0; i<=Size; i++)
double Result = Average.get(i)
Sum = Sum + Result;
}If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
anyway
List average = new LinkedList();
while (rst.next()){
// retrieve the number:
String mediaString = rst.getString(10);
Double media = Double.valueOf(mediaString);
// or maybe like this if it is a number in the database
Double media = new Double(rst.getDouble(10));
average.add(media);
doubleSum = 0.0;
for (Iterator it = average.iterator(); it.hasNext(); ){
Double result= (Double) it.next();
doubleSum += result.doubleValue();
} -
How to retrieve the list price for u0093Free of Chargeu0094 items?
Hi Gurus,
I need an urgent help: For the commercial invoice, I need to provide the List Price (PR00) value even for the Free of charge items. But for TANN, PR00 is not retrieved.
How can I still retrieve the list price(PR00) for Free of Charge items?
Thanks.Hi,
By giving item category as TANN in VBAP, you will be able to get all material numbers, and the document numbers.
Using document numbers, get the doc condition no, in VBAK (VBAK-KNUMV)
Now
VBAK-KNUMV = KONV-KNUMV and
VBAP-POSNR = KONV-KPOSN for VBAK-VBELN=VBAK-VBELN
you should be able to extract the value of PR00 from KONV table.
Hope this helps you
Pls reward if this helps you -
How to have ItemId in the URL in JSF based application
I have a JSF based application and I am using faces-config.xml to navigate and I am using /redirect to navigate form case to case.
The application lists products and upon selecting one, a product detail is displayed. I would like to have productId as part of the page URL so that URL can be emailed and the receiver can paste the received URL into browser and retrieve the product detail.
Currently the URL is not rewritten to have session id in it.
I am not ever sure where to start on this.Is this line correct?
<value>#{param.productId}</value>
Try it out yourself ;)
This is clear and helpful. However I don't know how
to create this URL
(http://example.com/shop/products.jsf?productId=100)
in the first place. The URL I have is in the form of
http://example.com/shop/products.faces.
Is adding '?productId=100' to the URL something
configurable or it has to be done programmatically
via URL rewriting?You can implement it in several ways:
JSF<h:outputLink value="products.faces">
<h:outputText value="click here" />
<f:param name="productId" value="100" />
</h:outputLink>
<%-- or --%>
<h:outputLink value="products.faces?productId=100">
<h:outputText value="click here" />
</h:outputLink>Or write a servlet listening on /shop/, scan the current request URI for product.faces, get the productId from the backing bean's session and rewrite the URL using request.getRequestDispatcher("product.faces?productId=" + productId).forward(request, response).
Maybe there are more clever solutions using configfiles, but I don't have much experience (yet) with such GET request thingies in conjunction with JSF. -
Hello,
is there anything in Oracle Internet Directory that corresponds to what in Microsoft Active Directory are links and backlinks???
Having placed a user inside a set of groups, how can I efficiently retrieve the list of groups the user belongs to??? In AD links and backlinks are used for this: when I place a user inside a group the member attribute on the group is populated with the DN of the user and AD places the DN of the group inside the memberOf backlink attribute of the user. This allows for efficiently retrieving the list of groups the user belongs to. How does all this work in OID???
Thanks.
BobHi prigas
Yes, I also thought this Q was rather rough.. Here's a copy & paste of the question, ANY help whatsoever would be appreciated - even if you have hints as to methods,etc I should consider...
We are currently studying recursion...if hat helps at all!
Any help at all - please?!?!? Thanks a lot!
Actual Q:
~~~~~~~~~~~~~~~~~
Write a program to compute a simple 3x3 spreadsheet containing both integers and strings. Firstly, there would be input from the user (in rows - see example below), then perform calculations on the user input as outlined below ...and finally, output the computed spreadsheet as a matrix.
Your program only needs to cater for addition/subtraction formula. Your columns (numbered A,B,C) and rows (numbered 1,2,3) will never be more than a single character and cell values/formulae have no spaces or errors. Examples of formulae are:
=A1, =A1+B1, =A1+A2-A3, =B3-C3
Sample Input
1 2 3 4 5 6 =A1+A2 =B1+B2 =C1+C2
Sample Output
1 2 3
4 5 6
5 7 9
Sample Input
Jack 12 23 Jill 45 67 Total =B1+B2 =C1+C2
Sample Output
Jack 12 23
Jill 45 67
Total 57 90
~~~~~~~~~~~~ -
How to find out the IP@s of all nodes in a cluster?
Is there any way to retrieve the IP addresses of all nodes in a cluster?
The problem is the following. We intend to write an administration program
that administers all nodes of a cluster using rmi (e.g. tell all singletons
in the cluster to reload configuration values etc.). My understanding is
that rmi only talks to a single node in a cluster. It would be a convenient
feature if the administration program could figure out all nodes in a
cluster by itself and then administers each node sequentially. So far we're
planning to pass all IP addresses to the administration program e.g. as
command line arguments but what if a node gets left out due to human error?
Thanks for your help.
BernieThere is no public interface to inquire about the IP addresses of the servers in a cluster. If you use WLS 6.0, there is an administrative console that uses JMX to manage the cluster. Perhaps that would be of use to you?
Bernhard Lenz wrote:
Is there any way to retrieve the IP addresses of all nodes in a cluster?
The problem is the following. We intend to write an administration program
that administers all nodes of a cluster using rmi (e.g. tell all singletons
in the cluster to reload configuration values etc.). My understanding is
that rmi only talks to a single node in a cluster. It would be a convenient
feature if the administration program could figure out all nodes in a
cluster by itself and then administers each node sequentially. So far we're
planning to pass all IP addresses to the administration program e.g. as
command line arguments but what if a node gets left out due to human error?
Thanks for your help.
Bernie
Maybe you are looking for
-
Smartforms: print accompanying documents
Hi, I have to reproduce in Smartforms the same output as the existing legacy system. Legacy system automatically outputs 1)A Quotation 2)A Condition of Sale document (always printed out) (PDF file, 2 pages, contents are numbered and appear in 2
-
Data Over flow in Reports 10g for the report U.S Sales Tax Report
Hi, we are running the "U.S Sales Tax Report" in which we are facing the data overflow as an issue. Do any body have an idea how to fix this type of issue. Thank you, BOD
-
Using the Assistive touch option
My last discussion was related to the Home button malfunctioning in a recently bought iPhone 5. The store exchanged it for a new one and now I would like to use the assistive touch option to keep from having to press any of the buttons: volume, home,
-
My video camara is not syncronized with the audio
Ok so i tried making a video on photo booth and it does record its just that when I play the video the audio is not syncronized. the video shows and right when it ends then the sound goes on.
-
puchased mountain lion from app store and tried downloading via store 4 times, always rcvg an alert stating "error downloading" Is there any other mean to get the mountain lion. I ve a 512kbps connection.