stanza
05-06-2009, 07:14 AM
Hi all,
I have some text in plain ol' XML. I also have a HTML template, which XSLT creates. This has an area for justified text which is 400px in width and 600px in height.
I want to use XSTL to parse the XML data and input it into that template. No problem so far.
However, when the XML data reaches the end of the template, 600px, I want XSLT to create a new page, like the first. So, basically the site will be in "pages", as paper documents are.
I am having difficulty working out where one page ends and another begins.
I had thought about calculating the size of individual letters (height and width) for a certain font and how many words will fit in a justified line. Then I could calculate how many lines a piece of text would take up - each line taking up 400px. This solution is a little too complex, however.
Also, I had thought about using XSLT to create a justified document 400px in width and then inputting the XML data into that. With that I could calculate how many lines are in that document, by counting the new line characters, I could then compare it to the number of lines I can fit into a 600px in length page. But I cannot think of a document format that would allow me to do this from XSLT.
Do you have any ideas on how I could calculate where a page ends?
Thanks.
I have some text in plain ol' XML. I also have a HTML template, which XSLT creates. This has an area for justified text which is 400px in width and 600px in height.
I want to use XSTL to parse the XML data and input it into that template. No problem so far.
However, when the XML data reaches the end of the template, 600px, I want XSLT to create a new page, like the first. So, basically the site will be in "pages", as paper documents are.
I am having difficulty working out where one page ends and another begins.
I had thought about calculating the size of individual letters (height and width) for a certain font and how many words will fit in a justified line. Then I could calculate how many lines a piece of text would take up - each line taking up 400px. This solution is a little too complex, however.
Also, I had thought about using XSLT to create a justified document 400px in width and then inputting the XML data into that. With that I could calculate how many lines are in that document, by counting the new line characters, I could then compare it to the number of lines I can fit into a 600px in length page. But I cannot think of a document format that would allow me to do this from XSLT.
Do you have any ideas on how I could calculate where a page ends?
Thanks.