[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Getting all the values between empty elements
Err...you were right - way too optimistic of me. I apologize! I see what you are getting at with this solution, but I gave far too little information, I'm afraid...and I can't seem to translate what you've suggested into an application that will work for my situation. Here's a bit more information (that I am quite sure everyone is sick of by now, but I can't quite get to the end of it): XML: <p style="Normal" tabs="0.2 1.2 2.7"> <tab/>A Few<tab/>Lime <c val="#0f0">Green</c><tab/>Octopii<br/> <tab/>Two<tab/>Red<tab/>Sharks<br/> <tab/><tab/><tab/>Or something far more sinister?<br/> </p> With some help from Ken and Andreas, and some of my own flailing about, I came up with this XSL to do the "rows" of a table to format this: <xsl:template match="ws:br" mode="rowcreate"> <xsl:variable name="current-row" select="position()"/> <xsl:variable name="number-of-cells" select="count(preceding-sibling::ws:tab) div $current-row"/> <xsl:variable name="lower-limit" select="($current-row - 1) * $number-of-cells"/> <xsl:variable name="upper-limit" select="$current-row * $number-of-cells"/> <fo:table-row> <xsl:for-each select="preceding-sibling::ws:tab"> <xsl:variable name="tab-number" select="position()"/> <xsl:if test="$tab-number>$lower-limit and $tab-number<=$upper-limit"> <xsl:choose> <xsl:when test="./preceding-sibling::node()[1][name()='br' or name()='tab']"> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> </xsl:when> <xsl:otherwise> <fo:table-cell> <fo:block> <xsl:value-of select="preceding-sibling::text()[1]"/> </fo:block> </fo:table-cell> </xsl:otherwise> </xsl:choose> </xsl:if> </xsl:for-each> <fo:table-cell> <fo:block> <xsl:value-of select="preceding-sibling::text()[1]"/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:template> What I want to do is replace the <xsl:value-of select="preceding-sibling::text()[1]"/> with an apply-templates on everything between either a tab and another tab, or a br and a tab. I can't just loop through the preceding(or following) sibling tabs, or the child of p tabs, because when I go through each "set" of tab-siblings, I have to do different treatments to ensure that <br/> tags will end a row. That's what all that silly lower-limit and upper-limit business is about... Thanks, KP XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|