f



Select Node Using position or value of another node.

Hi,

I'm trying to get the value of another node using the position of
another node or the name of the tag.
 Such that the current node is one of the contacts child nodes sec or
prim
   and doing
   <xsl:value-of select="//cust[seq = position()]/name"/>


   Should return jon for the prim tag and peter for the sec tag, but
fails as position() appears to resolve to the position of cust not the
contacts node

   alternatively I would like to do something like

   <xsl:value-of select="//cust[seq = [name()='prim' then 0 else
1]]/name"/>

<custs>
  <cust>
    <seq>0</seq>
    <name>jon</seq>
  </cust>
  <cust>
    <seq>1</seq>
    <name>peter</seq>
  </cust>
  <contacts>
    <prim>
       <message>hello</message>
    </prim>
    <sec>
       <message>hello</message>
    </sec>
   </contacts>
</custs>

0
eddy73 (28)
10/14/2005 9:17:24 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

6 Replies
539 Views

Similar Articles

[PageSpeed] 11

Eddy C wrote:

> Hi,
> 
> I'm trying to get the value of another node using the position of
> another node or the name of the tag.

For the difference between tags and elements, see the XML FAQ at
http://xml.silmaril.ie/authors/makeup/

>  Such that the current node is one of the contacts child nodes sec or
> prim
>    and doing
>    <xsl:value-of select="//cust[seq = position()]/name"/>
> 
> 
>    Should return jon for the prim tag and peter for the sec tag, but
> fails as position() appears to resolve to the position of cust not the
> contacts node

In cust[...position()...], the value of position() refers to the position of
the cust among its siblings, starting at 1.

>    alternatively I would like to do something like
> 
>    <xsl:value-of select="//cust[seq = [name()='prim' then 0 else
> 1]]/name"/>

This is not a well-formed document. I assume you meant to use </name>
after jon and peter.

If so, cust[position()=seq+1]/name will return jon and peter.

> <custs>
>   <cust>
>     <seq>0</seq>
>     <name>jon</seq>
>   </cust>
>   <cust>
>     <seq>1</seq>
>     <name>peter</seq>
>   </cust>
>   <contacts>
>     <prim>
>        <message>hello</message>
>     </prim>
>     <sec>
>        <message>hello</message>
>     </sec>
>    </contacts>
> </custs>

I'm not clear what you want from this. Are you trying to access the 
message belonging to each name, or the name belonging to each message?

///Peter

0
Peter
10/15/2005 2:46:03 PM
Sorry Peter, I'll try and be a little clearer.  There was a mistake in
the XML, which you correclty identified.

The idea is to fetch the name from the cust node, where the seq equals
the position-1 of the prim and sec nodes within the customers tag. i.e
prim is at position 1 and cust is at position 2.

Therefore the primary (prim) customer would have a name of Jon and the
secondary (sec) customer would have a name of peter.


<custs>
  <cust>
    <seq>0</seq>
    <name>jon</name>
  </cust>
  <cust>
    <seq>1</seq>
    <name>peter</name>
  </cust>
  <contacts>
    <prim>
       <message>hello</message>
    </prim>
    <sec>
       <message>hello</message>
    </sec>
   </contacts>
</custs>

0
eddy73 (28)
10/15/2005 6:28:13 PM
Eddy C wrote:

> Sorry Peter, I'll try and be a little clearer.  There was a mistake in
> the XML, which you correclty identified.
> 
> The idea is to fetch the name from the cust node, where the seq equals
> the position-1 of the prim and sec nodes within the customers tag. i.e
> prim is at position 1 and cust is at position 2.
> 
> Therefore the primary (prim) customer would have a name of Jon and the
> secondary (sec) customer would have a name of peter.
> 
> 
> <custs>
>   <cust>
>     <seq>0</seq>
>     <name>jon</name>
>   </cust>
>   <cust>
>     <seq>1</seq>
>     <name>peter</name>
>   </cust>
>   <contacts>
>     <prim>
>        <message>hello</message>
>     </prim>
>     <sec>
>        <message>hi</message>
>     </sec>
>    </contacts>
> </custs>

OK, but if you are already distinguishing between prim and sec, and you know
they map directly to seq=0 and seq=1 respectively, I don't see the problem:

<xsl:choose>
  <xsl:when test="name()='prim'">
    <xsl:value-of select="//cust[seq=0]/name"/>
  </xsl:when>
  <xsl:when test="name()='sec'">
    <xsl:value-of select="//cust[seq=1]/name"/>
  </xsl:when>
</xsl:choose>

The only reason for doing it by counting would be if you had far more 
(other) element content in contacts or cust than you are showing us.
In which case the content of contacts would surely not be prim and sec
but some other element which could be enumerated. Usually the reason for
naming element types a certain way is because it describes *different*
types of data, whereas here the element content of prim and sec is 
identical.

This appears to be a peculiarly obtuse piece of design. Why not

<customers>
  <customer n="0" type="primary" name="jon" message="hello"/>
  <customer n="1" type="secondary" name="peter" message="hello"/>
</customers>

By all means give the customer element subelement content if the character
data content of name and message is more complex, but I see no value in 
segmenting the primary/secondary classification from the customer data.

///Peter


0
Peter
10/16/2005 12:46:50 AM
Peter,

Its not my design, I'm just the consumer and needed to find a way to
come up with a single XPath query to get the associated bit of data.

Also the example I gave is very stripped down. Looking at the Schema
doc prim and sec have very different attributes but the record we are
trying to join to has the same attributes for both.

So it looks like its not going to be simple to do this in one single
XPath query.

0
eddy73 (28)
10/17/2005 4:02:05 PM
Eddy C wrote:

> Peter,
> 
> Its not my design, I'm just the consumer and needed to find a way to
> come up with a single XPath query to get the associated bit of data.
> 
> Also the example I gave is very stripped down. Looking at the Schema
> doc prim and sec have very different attributes but the record we are
> trying to join to has the same attributes for both.
> 
> So it looks like its not going to be simple to do this in one single
> XPath query.

OK, if it has to be done that way...
If your current element is either prim or sec, then

/custs/cust[seq=count(current()/preceding-sibling::*)]/name

will return the name of the matching customer.

///Peter
0
Peter
10/17/2005 9:12:25 PM
Very nice, I really appreciate your help.

0
eddy73 (28)
10/17/2005 11:02:40 PM
Reply:

Similar Artilces:

Get XML values from nodes and child nodes
Hi everybody. My XML file is: <Locatore> <NumeroProgressivo>001</NumeroProgressivo> <CodiceFiscale>CSTNDA69P90H523R</CodiceFiscale> <PersoneFisiche> <Cognome>CAST</Cognome> <Nome>NADIR</Nome> <Sesso>F</Sesso> <DataNascita>10091979</DataNascita> <ComuneNascita>RONCA</ComuneNascita> <ProvinciaNascita>BL</ProvinciaNascita> </PersoneFisiche> </Locatore> <Locatore> <NumeroProgressivo>002</NumeroProgressivo> <CodiceFiscale>PRSGRI74L29F443L</CodiceFiscale> <PersoneFisiche> <Cognome>PERISSI</Cognome> <Nome>IGOR</Nome> <Sesso>M</Sesso> <DataNascita>29071970</DataNascita> <ComuneNascita>MONTE</ComuneNascita> <ProvinciaNascita>SA</ProvinciaNascita> </PersoneFisiche> </Locatore> I need to get in ONE RECORD, both node value and his child nodes values, like this 001 | CSTNDA69P90H523R | CAST | NADIR | F | 10091979 | RONCA | BL 002 | PRSGRI74L29F443L | PERISSI | IGOR | M | 29071970 | MONTE | SA ..... With this: SELECT X.valore.query('NumeroProgressivo').value('.', 'VARCHAR(20)') as NumeroProgressivo, X.valore.query('CodiceFiscale').value('.', 'VARCHAR(16)') as CodiceFiscale FROM Tbulk CROSS APPLY Tbulk.nodes('Fornitura/Documento/S...

Selecting Nodes Using Subtotal of Child Nodes
I'm having difficulty finding the correct syntax that will allow me to select a group of invoices based on the total of an amount column located in its line items. Below are simplified examples of my XML and XSLT files: XML FILE <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="OutstandingInvoiceBalances.xslt"?> <ProgramData> <Invoices> <InvoiceID>1</InvoiceID> <InvoiceNumber>100</InvoiceNumber> <Amount>1000.00</Amount> </Invoices> <Invoices> <InvoiceID>2</InvoiceID> <InvoiceNumber>101</InvoiceNumber> <Amount>2000.00</Amount> </Invoices> <Invoices> <InvoiceID>3</InvoiceID> <InvoiceNumber>102</InvoiceNumber> <Amount>3000.00</Amount> </Invoices> <InvoiceLineItems> <InvoiceLineItemID>1</InvoiceLineItemID> <InvoiceID>1</InvoiceID> <AmountToPay>0</AmountToPay> </InvoiceLineItems> <InvoiceLineItems> <InvoiceLineItemID>2</InvoiceLineItemID> <InvoiceID>2</InvoiceID> <AmountToPay>100</AmountToPay> </InvoiceLineItems> <InvoiceLineItems> <InvoiceLineItemID>3</InvoiceLineItemID> <InvoiceID>2</InvoiceID> <AmountToPay>200</AmountToP...

selecting nodes between other nodes
Hi! <root> <foo>bar</foor> <blah /> <blah2 /> <a> <b /> <c /> </> </root> I want to select everything between <foo> and <a>. Is this possible? Timo In article <2jbjjhFvf4ttU1@uni-berlin.de>, Timo Nentwig <tcn@spamgourmet.org> wrote: % <root> % <foo>bar</foor> % <blah /> % <blah2 /> % <a> % <b /> % <c /> % </> % </root> % I want to select everything between <foo> and <a>. Is this possible? How about <xsl:stylesheet xmlns:xsl = 'http://www.w3.org/1999/XSL/Transform' version = '1.0'> <xsl:template match='*[preceding-sibling::foo and following-sibling::a]'> <xsl:copy-of select = '.'/> </xsl:template> <xsl:template match='text()'/> </xsl:stylesheet> ? -- Patrick TJ McPhee East York Canada ptjm@interlog.com ...

XSLT Select nodes without text-node children whose names starts with specifix text
Question on XSL expression Got this XML: <Body> <Page> <Line no="9" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="10" detail="true"> <onefield>onefieldstext</onefield> <fgman9>fgmanfieldstext</fgman9> <twofield>twofieldstext</twofield> </Line> <Line no="11" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="12" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="13" detail="true"> <onefield>onefieldstext</onefield> <fgman5>fgmanfieldstext</fgman5> <twofield>twofieldstext</twofield> </Line> <Line no="14" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> </Page> </Body> I would select the <Line/> nodes without text-node children whose names is starting with "fgman" - in this example it is all <Line/> _except_ <fgman9/> and <fgman5/> in <Line/> with @no of 10 and 13. I know that this works: &...

Getting all nodes and node details from xml using xquery
Hi, I haev the following code: DECLARE @x xml SET @x=' <Root> <row id="1"><name>Larry</name><oflw>some text</oflw></row> <row id="2"><name>Joe</name></row> <row id="3" /> </Root> ' exec sp_xml_preparedocument @idoc OUTPUT, @x SELECT * FROM OPENXML(@idoc, '/Root') This gives the following details id parentid nodetype localname prefix namespaceuri datatype pr...

select nodes with child node A and child node B
I have an XML document that has multiple childe nodes like the one at the end of this message What syntax would I use with selectNodes to select all viewentry nodes that have an entrydata child node with a name attribute equal to "CourseOrMeetingName" that has a text childe node with the text Course ABC AND that also have an entrydata child with a name attribute equal to Start Date that has a datetime child node with the text 20070110 I was trying something like //viewentry[ (entrydata[@name='CourseOrMeetingName'][text='Course ABC']) and (entrydata[@name='StartDate'][datetime='20070110'])]" <viewentry position="1" unid="E5FE575692CAB4CD852572140052F751" noteid="893A" siblings="24"> <entrydata columnnumber="0" name="CourseOrMeetingName"> <text>Course ABC</text></entrydata> <entrydata columnnumber="1" name="StartDate"> <datetime>20070110</datetime></entrydata> <entrydata columnnumber="2" name="City"> <text>West chester</text></entrydata> <entrydata columnnumber="3" name="FirstName"> <text>Joe</text></entrydata> <entrydata columnnumber="4" name="MiddleName"> <text></text></entrydata> <entrydata columnnumber="5" name="LastName"> <text>...

[HELP] Create a DOM using a node from another node
Hi, I'm posting an answer for people looking about the same thing. private Document createNewDOM(Document srcDocument) { try { //Create the resulting DOM Document resultDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); //import an element (here, it is the root element) from first DOM DocumentFragment df = srcDocument.createDocumentFragment(); documentFragment.appendChild(srcDocument.getDocumentElement()); //Create the Node to append to the new DOM Node importNode = resultDocument.importNode(documentFragment, true); resul...

Select nodes from another XML document?
Hi, Maybe I've got a strange question. I've got a XML document (main.xml) with several nodes. Additional I've another XML docuement (role.xml), with allowed nodes. In a XSL-File I just would like to extract nodes from the main.xml file, which were declared in role.xml. Example: main.xml: <main> <firstname>Tom</firstname> <lastname>Jones</lastname> <street>Sunset 11</street> <state>CA</state> .... </main> Role.xml: <role> <field>lastname</field> <field>state</field> </role> So I just want to extract "lastname" (Jones) and "state" (CA) from the main.xml. I just tried following XSLT on Main.xml: <xsl:template match="/"> <xsl:apply-templates select="document(Role.xml)/role"/> </xsl:template> <xsl:template match="role"> <xsl:for-each select="field"> <xsl:value-of select="/main//current()"/> </xsl:for-each> </xsl:template> In match="role" all "fields" nodes from Role.xml are traversing. So now each found node (lastname, state) should be selected in main.xml (/main/lastname and /main/state). The XSL should output "Jones" and "CA". But it seems that I can't use current() in the "<xsl:value-of select=...". Does anyone know a solution? Thanks a lot for helping! Chris wrote: >...

XSL HOWDOI use attribute of current node to select a different node?
I know I can select a node by attribute value using something like <xsl:apply-templates select="//*[@Name='Joe']"/> How can I replace Joe with an attribute from the current node? I.e., the current node has an attribute Manager="Fred". I want a select expression something like "//*[@Name='"<xsl:value-of select="@Manager"/>"']" This gives me the text I want, but I can't figure out how to embed it into the xsl:apply-templates' select. I.e., the following won't work; <xsl:apply-templates select="//*[@Name='"<xsl:value-of select="@Manager"/>"']"/> I assume it's a notational nuance I don't know yet, but which will be immediately obvious once someone shows me what it is. Thanks. CB wrote: > I know I can select a node by attribute value using something like > > <xsl:apply-templates select="//*[@Name='Joe']"/> > > How can I replace Joe with an attribute from the current node? I.e., > the current node has an attribute Manager="Fred". Use current()/@Manager instead of 'Joe'. -- Johannes Koch In te domine speravi; non confundar in aeternum. (Te Deum, 4th cent.) ...

changing the values of xml nodes using PHP
Hi there, Is it possible to use PHP to change the values of XML nodes in an XML file witout having to extract all the node values, change the variable I want, use PHP to generate the node structure and then save it as an new XML file? For example, say I have the following XML structure in an XML file: <xml... <settings> <width>400</width> <hieght>500</hieght> <color>blue</color> . . . </settings> Is it possible to just use PHP to find the node 'width', change it to 600 and then resave the XML file? Cheers Burnsy &quo...

Why treat text nodes as nodes?
One of the things I find most unnatural about most XML APIs is that they try to abstract both elements and text into some kind of "node" object when they have virtually nothing in common. The reason these APIs do it is to make it possible for both text and elements to be children of elements. But there is another way. The XPath/XQuery data model does not allow two consecutive text nodes. As far as I can tell, most XML processing software automatically merges consecutive text nodes. This means that the number of text segments directly under an element is bound by the number of sub-elements plus 1 (PIs and comments may be treated as "pseudo-elements" for this purpose). As a result, it is always possible to associate each text segment with the element immediately preceding it within the parent and associate the first text element with the parent itself. No more text nodes. The only API I know that uses this trick is the ElementTree API for Python by Fredrik Lundh (http://effbot.org/zone/element-index.htm). Each Element object has a text and tail property for the text immediately inside the element and text following it within its parent element. Elements always have a tag, attributes and and zero or more children - which are always other elements. No mixed types. The text and tail attributes are always strings. This model should be very convenient for statically-typed languages like Java or C++. I find it ironic that this idea is probably used only in Pyt...

XML Node, HTML Node
hi guys, how can distinguish between XML Node and HTML Node, using attributes or method .. thanks . alhalayqa wrote: > how can distinguish between XML Node and HTML Node, using attributes or > method .. In the XML DOM nodes do not have an id property or a className property while in the HTML DOM nodes do have those properties. On the other hand there are specializations of the XML DOM like the SVG DOM where id or className are properties too. Thus if you parse XML with namespaces with browsers like Mozilla or Opera the parser recognizes namespaces like the XHTML 1 namespace o...

xsl variable $node/text() but $node can non-node-set help!
I have a variable $value as a parameter in the following template: <xsl:template name="myTemplate"> <xsl:param name="value"/> <xsl:if test="$value"> <xsl:value-of select="$value"/> </xsl:if> </xsl:template> Now i call myTemplate sometimes whit the a parameter $value that is sometimes a text node, and sometimes it is not even a node. Example: <inputDoc> <a>hello</a> <a/> </inputDoc> xsl: <xsl:for-each select="/inputDoc/a"> <xsl:call-template name="myTemplate"> <xsl:with-param name="value" select="./text()"/> </xsl:call-template> </xsl:for-each> So i call myTemplate with parameter $value=a/text() But for the second <a> element in <inputDoc> there is not text() node. This gives me the following error: Cause: javax.xml.transform.TransformerException: The value is not a node-set With line number of the error pointing to the xsl:if in myTemplate. No i tried the function nilled(), but that is XPath 2.0, i only use XPath 1.0 and XSL 1.0 i know a possible solution is this: <xsl:for-each select="/inputDoc/a"> <xsl:choose> <xsl:when test=".[not(node())]"> <xsl:call-template name="myTemplate"> <xsl:with-param name="value" select="false()"/> </xsl:call-template> <...

selecting the value of the node based on the value of parameter
i have an xml file <catalog> <cd> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company> <price>10.80</price> <year>1996</year> </cd> <cd> <title>When a man loves a woman</title> <artist>Percy Sledge</artist> <country>USA</country> <company>Atlantic</company> <price>8.70</price> <year>1987</year> </cd> <cd> <title>Black angel</title> <artist>Savage Rose</artist> <country>EU</country> <company>Mega</company> <price>10.90</price> <year>1995</year> </cd> <cd> <title>1999 Grammy Nominees</title> <artist>Many</artist> <country>USA</country> <company>Grammy</company> <price>10.20</price> <year>1999</year> </cd> </catalog> i need to get the individual elements value under the cd tag and my xsl looks like <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="mycount" /> <xsl:param name="myelement" /> <xsl:template match="/"> <xsl:for-each select="/catalog/cd"> <xsl:if test="position()=$myco...

Reality check: Is it sensible to link XML nodes to other XML nodes in the same file?
I've got a whole list of descriptions of stages in a production process, which are organised as a sequence of steps, with some branching (i.e. a sort of flow chart)... and thought I'd try and get with the times and model the data using XML! I'm hoping I'll eventually be able to display each 'step' (node) on it's own Web page, and show what link comes next. Is this a sensible thing to attempt to do? If so, how do I link to other nodes in the XML file? Should the <link> be to another node's <id>? And will each node need a 'friendly' <name>, too? (As you've probably gathered, this is all quite new to me...) Any advice or examples would be gratefully received. Gavnosis ...

Text nodes and element nodes query
Hi all, The code below gets me a list of all the nodes within the node object called xml_tags_root. NodeList nl = xml_tags_root.getChildNodes(); The length of nodelist I get is double the number of actual elements! This is because after every element node there is text node which is (I think) the whitespace in the XML document. Is there a way to get only the element nodes? Please advice. thanks, ASD Hi, Look at getElementsByTagName(....) Regards, Arnaud "asd" <arvindsd@yahoo.com> a �crit dans le message news: 1116833345.887839.95270@g47g2000cwa.googlegroups.com... &...

PSTricks--Node relative to another node?
In PSTricks, how do I define the position of one node relative to another node? That is, suppose I have defined node A; how do I define node B say, to at the coordinates of A + (0.5*\n, -1), where \n is a counter in a multi-do. -- Professor Edward M. Reingold Email: reingold@iit.edu Department of Computer Science Voice: (312) 567-3309 Illinois Institute of Technology Fax: (312) 567-5067 Stuart Building, 228F 10 West 31st Street Chicago, IL 60616-3729 U.S.A. On 3 z=C3=A1=C5=99, 20:19, reing...@emr.cs.iit.edu (Edward M. Reingold) wro= te: > In PSTricks, how do I define the position of one node relative to another > node? =C2=A0That is, suppose I have defined node A; how do I define node = B say, to > at the coordinates of A + (0.5*\n, -1), where \n is a counter in a multi-= do. > -- I think that a clever combination of \hbox to 0 pt, \vbox to 0 pt, \hss, \vss, \hskip and \vskip (or \kern) can be used to resolve the problem. Simply put (to the same place as node A) box with zero width and zero height, vhich contains another node shifted ... units left- right and ... units top-bottom. Remember to clean spaces from line ends, if necessary. Robert. > > Professor Edward M. Reingold =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0Email: reing...@iit.edu > Department of Computer Science =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Voice: (312) 567-3309 > Illinois Institute of Technology =C2=A0 =C...

XML DOM: XML/XHTML inside a text node
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us...

Retrieving XML attribute using XML::XPath::Node::Attribute
Hi I am trying to retrieve an attribute of a particular node from my XML using "XML::XPath::Node::Attribute", but couldn't come across on how to successfully use it in my code. For example, if my xml is: <?xml version="1.0" ?> <data> <server_address port="40">10.0.0.1</server_address> </data> How do I go about fetching the "port" attribute from "server_address" element? Vikrant vikrant wrote: > > <?xml version="1.0" ?> > <data> > <server_address port="40&q...

How to find non-existing nodes or nodes with no text
Ok, this must be simple but the more i search the more i don't find. It's about SimpleXML and PHP. How to find non-existing nodes or nodes with no text My XML file looks a little bit like this: i.e. 1 <discography> <CD> <title></title> <year>1978</year> </CD> </discography> i.e. 2: <discography> <CD> <year>1978</year> </CD> </discography> In i.e. 1, the tag <title> is empty. How do i test for empty tags in PHP? In i.e. 2, the tag <title> doesn't even exist. How do i ...

I want to select all the node names beneath a given node
Dear all I have a diffgram: <?xml version="1.0" standalone="yes"?> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <NewDataSet> <PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0" diffgr:hasChanges="modified"> <PolicyID>POL0001</PolicyID> <InsuredName>Insured Co 111</InsuredName> <InceptDate>2007-01-01T00:00:00+00:00</InceptDate> <BrokerCode>BKR1</BrokerCode> <UW>U1</UW> <LimitCCY>GBP</LimitCCY> <LimitAmt>1000001.00</LimitAmt> <SharePctg>0.10</SharePctg> <Status>L</Status> </PolicyInwards> <PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1" diffgr:hasChanges="modified"> <PolicyID>POL00010</PolicyID> <InsuredName>Insured Co 10</InsuredName> <InceptDate>2007-01-15T00:00:00+00:00</InceptDate> <BrokerCode>BKR10</BrokerCode> <UW>U10</UW> <LimitCCY>USD</LimitCCY> <LimitAmt>1000010.00</LimitAmt> <SharePctg>1.00</SharePctg> <Status>L</Status> </PolicyInwards> <PolicyInwards diffgr:id="PolicyInwards...

TREEVIEW: How to display all parent nodes for opened and selected node?
When use TreeView I want to display entire "path" of opened node. To be precise - when node is selected and/or opened, is it possible (and how) to get all other parent nodes of that selected/opened node? I tried everything but can't get to solution... :( Arminio /Temp from Google/ arminio_grgic@yahoo.com wrote: > When use TreeView I want to display entire "path" of opened node. To be > precise - when node is selected and/or opened, is it possible (and how) > to get all other parent nodes of that selected/opened node? Given a node, you ca...

extracting text from an XML node
Hi, suppose i get the simple xml sample: <foo> 1 <bar>2</bar> 3 </foo> Now suppose i want to extract all the text of only the 'foo' node, ie expected result is '1 3'. I tried both <xsl:template match="foo"> <xsl:value-of select="text()" /> </xsl:template> and <xsl:template match="foo"> <xsl:value-of select="." /> </xsl:template> but the former lead to '1' and the latter to '1 2 3' (using xsltproc & firefox). What did i missed ? thanks, -Nicolas nicolas.edel@gmail.com wrote: > Now suppose i want to extract all the text of only the 'foo' node That isn't a built-in concept; you have to recast it as "all the text nodes which are immediate children of the 'foo' node". (The built-in text value of an element, as you discovered, is the value of all text contained in it, directly or indirectly). Note too that the whitespace (line breaks and indentation) will be part of the the text nodes unless you explicitly strip that away. <xsl:value-of select="text()" /> didn't work because value-of returns the contents of only the first matching node. This is one case where xsl:for-each is appropriate, to explicitly iterate through the text children. -- Joe Kesselman / Beware the fury of a patient man. -- John Dryden On Nov 30, 12:34 am, Joseph Kesselman <kesh...

select dom text nodes
Hi, I want to select all the text nodes of an xml document using msxml dom. I tried using the selectNodes method with "//#text" argument. But it fails. Can anybody help please? Thank you. On Apr 13, 11:22 am, avs...@gmail.com wrote: > I want to select all the text nodes of an xml document > using msxml dom. I tried using the selectNodes method > with "//#text" argument. I don't believe there's a selectNodes() method in the W3C DOM specs. Assuming it accepts an XPath expression as an argument, what you need is '//text()'. #text is a nodeName, and is fairly meaningless in the context. Consider reading some sort of XPath tutorial, because invoking magic without understanding how it works is a recipe for disaster, as I can attest from painful personal experiences. -- Pavel Lepin Hey.. Thank you very much. That worked!! I m using MSXML and there is a selectNodes method. Yes, I agree that reading throughly before attempting a task is always the best way to work on something. Once in a while we all come across tasks where we dont have enough time to be thoroughly trained before attempting something. To be fair to me :-), I did go thru the material in MSDN on XPath. Most of it is given in the context of XSLT. That partly obstructed my learning. Inspite of that, I didnt find any reference to selecting all text nodes. After you pointed out, I did check the w3schools tutorial where I found a similar point documented, thanks to you...

Web resources about - Select Node Using position or value of another node. - comp.text.xml

Squatting position - Wikipedia, the free encyclopedia
Squatting is a posture where the weight of the body is on the feet (as with standing ) but the knees are bent either fully (full or deep squat) ...

Parramatta Eels salary cap scandal: NRL feel Steve Sharp's position untenable
There is a growing belief at the Eels and at the NRL that Parramatta chairman Steve Sharp must fall on his sword over the latest salary cap drama ...

Aussie brain drain hits scientific leaders, research positions
A BRAIN drain has stripped Australia of one in four of its scientific leaders and 671 research positions as our best and brightest head overseas. ...

Parramatta Eels salary cap scandal: NRL feel Steve Sharp's position untenable
There is a growing belief at the Eels and at the NRL that Parramatta chairman Steve Sharp must fall on his sword over the latest salary cap drama ...

President Obama urges prudence from both sides of encryption debate, warns against 'absolutist' position ...
Speaking on the encryption debate at SXSW Interactive in Austin on Friday, President Barack Obama carefully navigated the waters between government ...

Watson-powered robot mans concierge position at Hilton Hotel
Remember Watson? It's the artificially intelligent computer from IBM that can beat Jeopardy champions and is used in cancer-related research ...

Donald Trump reverses position on torture, killing terrorists' families
CNN Donald Trump reverses position on torture, killing terrorists' families CNN Washington (CNN) Republican front-runner Donald Trump moved ...

LeBron James Would Have Willingly Switched Positions If Joe Johnson Signed With The Cavs
... made a hard run at him, but the not-good swingman signed with the Miami Heat. LeBron admitted today that he would’ve surrendered his position ...

Ariana Grande on Her Support for Kesha: 'I Don't Think a Male Artist Would Be in This Position'
Ariana Grande on Her Support for Kesha: 'I Don't Think a Male Artist Would Be in This Position'

Convector Capital Management LP Buys New Position in QUALCOMM, Inc. (QCOM)
Convector Capital Management LP bought a new position in shares of QUALCOMM, Inc. (NASDAQ:QCOM) during the fourth quarter, according to its most ...

Resources last updated: 3/13/2016 11:20:11 PM