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

<div style="position:absolute;top:224;left:108">The line was longer than we expected</div>

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?

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

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

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).

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.