954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Using XSLT to pull particular text from a specific element in an xhtml file

I have an xhtml document that contains many lines that look like:

The line was longer than we expected

For my first trick I need to be able to match or select this node and others like it, where like it means that it is a div tag with a style attribute that starts out saying polition:absolute, so that I can deal with it in some XSLT construct such as a template.

For my second trick, I need to pull out the number that comes after top, in this case 224.

For my third trick, I need to find the two elements that have either the largest value of top or the smallest value of top.

I am allowed to use either XSLT 1 or XSLT 2. However, I would prefer to use the XSLT version.

Can anyone help?

achava
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

I have solved the problem of Trick 1. I think the key is really trick 2.

achava
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

I have now solved trick 2. This is amazing me. I use substring-before() and substring-after(). It seems to me that using using these numbers somehow as what to do a numerical sort on, but it will be awhile before I figure out the syntax.

achava
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

I have managed, to my great surprise, to sort the lines that I am looking for in numerical order based on the numbers of pulled out of the string. It turns out that I needed to do that, but nonetheless I don't yet know how to find the text within the line that has the minimum of these numbers (or the maximum, both work).

achava
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

I managed to solve the entire problem, so it is done. I guess I can declare myself to no longer be a newbie.

achava
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You