p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   XPath Invalid token (http://p2p.wrox.com/showthread.php?t=64143)

Hughesie78 November 29th, 2007 09:50 AM

hey,
here is my XML:
<Banks>
  <Bank>
    <nsc>000000</nsc>
    <bank>Clears through Bank name</bank>
    <branch>london uk</branch>
  </Bank>
  <Bank>
    <nsc>111111</nsc>
    <bank>Clears through Bank name</bank>
    <branch>Dublin Irl</branch>
  </Bank>
  <Bank>
    <nsc>000000</nsc>
    <bank>Clears through Bank name</bank>
    <branch>Manc uk</branch>
  </Bank>
  <Bank>
    <nsc>111111</nsc>
    <bank>Bank two</bank>
    <branch>Dublin Irl</branch>
  </Bank>

</Banks>

so I have drop down with a lis distinct bank, once they select the bank a 2nd drop down shows list of distinct branch.
once they select the branch, i was to display the <nsc> value.

<Banks> is root node
<Bank> is parent
<bank> and <nsc> are siblings .. you can correct me there im relatively new to XML.

samjudson November 29th, 2007 09:56 AM

The following xpath should get you the nsc element:

/Banks/Bank/nsc[../bank='A' and ../branch='B']

/- Sam Judson : Wrox Technical Editor -/

mhkay November 29th, 2007 09:58 AM

Well yes, you would expect an expression passed to SelectNodes() to evaluate to a node-set, and an expression that uses the "and" operator will evaluate to a boolean. So what result were you expecting for your expression?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Hughesie78 November 29th, 2007 12:59 PM

hey, thanks it worked perfect!!


All times are GMT -4. The time now is 11:45 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.