Subject: RE: Counting nodes up to a certain sibling
From: Mario Madunic <hajduk@xxxxxxxx>
Date: Thu, 8 Mar 2007 14:48:56 -0800
|
Mike,
If each row ends with linefeed/carriage return (after the columns), I'd suggest
writing a called template that uses the span space as a delimiter. Keep parsing
the supplied line till there there are no longer any span space and content. Or
if you are inclined use something like ant and a regular expression to convert
all span space to something more appropriate.
Mario
Quoting cknell@xxxxxxxxxx:
> A sample of your input would make helping you a good deal easier. Is this
> what you're faced with?
>
> <div>
> First column<span> <span>Second column<span>
> </span>
> </div>
>
> If not, please give a sample, not a description.
> --
> Charles Knell
> cknell@xxxxxxxxxx - email
>
>
>
> -----Original Message-----
> From: mclagett@xxxxxxxxxxx
> Sent: Thu, 08 Mar 2007 20:45:27 +0000
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Counting nodes up to a certain sibling
>
> Hi -
>
> I am transforming an input html doc into an xml formatted output stream. The
> portion of the document I am now working with has been laid out in html as a
> set of columns, but instead of using tables they did it by inserting spaces
> enclosed within span tags (aaarrrggghhh!). I am attempting to implement this
> simple rule:
>
> for each span tag that includes a space, take all sibling nodes up to the
> next span tag and output thes within a single output tag.
>
> The document is structured such that these will only be text nodes or
> formatting nodes like <i> or <b> or <sub>. I'm having a hell of a time,
> however, figuring out how to create a node set that includes only nodes in
> between a current span node and its next sibling span node. I've been trying
> to work with the position() function, but in order to identify the next span
> node, I have to do it with an axis expression and a filter and then
> position() only tells me the position of the node with respect to the
> filtered set. I need to identify the position of a node matching my
> characteristics in an unfiltered parent node set. Can't seem to figure out
> how to do it. Is there a way?
>
> Thanks for any help anyone can offer. If this has been answered before, I
> apologize. I've spent an awful lot of time looking for it.
>
> Regards,
>
> Mike
|