• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use variable for index of element in XPath?

 
Nigel Chou
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a question about XSLT. Following XPath returns the 2nd attr_name element under content. Can the index be a variable?

I have tried:


They can not work.

Any idea to help? Thanks.
[ May 24, 2006: Message edited by: Nigel Chou ]
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:Not sure if it will work any better than your original ideas; from my reading of the XPath Recommendation it looks like your second example should work just as well. Maybe there's something else wrong with it, like your variable doesn't exist or isn't a number or something.
 
Nigel Chou
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
Try this:Not sure if it will work any better than your original ideas; from my reading of the XPath Recommendation it looks like your second example should work just as well. Maybe there's something else wrong with it, like your variable doesn't exist or isn't a number or something.


Thank you. You are right.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic