[Home] [By Thread] [By Date] [Recent Entries]
ms wrote:
Hi: Your XML is not well-formed. It usually helps to write XML with some XML editor and test it with your XSLT before sending it, and showing what output you currently get, and what you'd rather have instead.
So basically, you want the element order to stay the same as the input order. The short answer is: you don't need to do anything. Here is my XSLFO piece for tjis part: You showed XSLT , not XSL-FO. <xsl:choose> <xsl:when test="*[self: :image[following -sibling: :table] or self::image[ following- sibling:: text] or self::image] "> <xsl:apply-template s select="*[not( self::image) and not(self::table[ preceding: :image]) and not(self::text[ preceding: :image])] "/> </xsl:when> <xsl:otherwise> <xsl:apply-template s/> </xsl:otherwise> </xsl:choose> That is not valid XSLT. Please test your XSLT before sending it. Your code shows that it'd help you to find a good tutorial on the basics of XSLT processing. Using xsl:when in this way is unnecessary and superfluous. There are several ways to solve your problem, but basically, there is no problem at all: XSLT will do what you want automatically, though here's one: <xsl:template match="/"> <xsl:apply-templates select="mfunc/*" /> </xsl:template> <xsl:template match="l1"> ... do something with l1... <xsl:apply-templates /> </xsl:template> <xsl:template match="image"> ... do something with image ... <xsl:apply-templates /> </xsl:template> <xsl:template match="text"> ... do something with text ... <xsl:apply-templates /> </xsl:template> Note that the order of the xsl:template are unimportant. The output will look like you want: the elements before <l1> are processed before <l1> and the elements after <l1> are processed thereafter. And so will your output.
Yep, see above ;) Cheers, -- Abel Braaksma
|

Cart



