[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: nested output
> Here's the LaTeX transformed from the above: ?? the result you posted had no latex markup at all (and does have a couple of strange characters (octal 226, decimal 150) just after each page number, is that intended to be a dash of some sort? > pp. 15476. <xsl:template match="xhtml:span" mode="output-latex"> <xsl:variable name="content" select="."/> <xsl:for-each select="tokenize(@class, ' ')"> <xsl:variable name="css-class" select="."/> <xsl:choose> <xsl:when test="$css-class='italic'"> <xsl:text>\textit{</xsl:text> <xsl:value-of select="$content"/> <xsl:text>}</xsl:text> </xsl:when> <xsl:when test="$css-class='bold'"> <xsl:text>\textbf{</xsl:text> <xsl:value-of select="$content"/> <xsl:text>}</xsl:text> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$content"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> This will repeat the string-value of the content span once for each token in the class attribute. If your span ever has any markup that should be transformed you want apply-templates not value-of, and you only want to do it once. Also there's no need to do a for-each over tokenize(@class, ' ') as string equality testing automatically will work over the entire sequence. something like <xsl:template match="xhtml:span" mode="output-latex"> <xsl:variable name="c" select="tokenize(@class, ' +')"> <xsl:if test="$c='italic'">\textit{</xsl:if> <xsl:if test="$c='bold'">\textbf{</xsl:if> <xsl:apply-templates/> <xsl:if test="$c='italic'">}</xsl:if> <xsl:if test=".='bold'">}</xsl:if> </xsl:template> untested David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
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
|