[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

multiple output targets (was use-when attribute?)

Subject: multiple output targets (was use-when attribute?)
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Sat, 18 Dec 2004 12:57:01 -0500
xsl when attribute
Alright, I think I may have figured it out!

I have a main stylesheet that has this main template:

  <xsl:template match="/">
    <html>
      <head>
        <title>Testing</title>
      </head>
      <body>
        <div id="content">
          <div id="main-content">
            <xsl:apply-templates/>
            <div id="bibliography">
              <xsl:call-template name="bib:format-bibliography">
                <xsl:with-param name="output-format='xhtml'"/>
              </xsl:call-template>
            </div>
          </div>
        </div>
      </body>
    </html>
  </xsl:template>

The template I'm calling there then has this:

  <xsl:template name="bib:format-bibliography">
    <xsl:param name="output-format" select="$output-format"/>
    <xsl:choose>
      <xsl:when test="$output-format='latex'">
        <xsl:apply-templates mode="output-latex"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="$bib:formatted-biblist"/>
      </xsl:otherwise>
    </xsl:choose>
</xsl:template>

The content of $bib:formatted-biblist is xhtml.

I then have an output-driver.xsl file with code like this:

  <xsl:template match="xhtml:p[@class='bibref']" mode="output-latex">
    <xsl:apply-templates mode="output-latex"/>
  </xsl:template>

  <xsl:template match="xhtml:span" mode="output-latex">
    <xsl:choose>
      <xsl:when test="@style">
        <xsl:choose>
          <xsl:when test="contains(@style, 'italic')">
            <xsl:text>\textit{</xsl:text>
            <xsl:value-of select="."/>
            <xsl:text>}</xsl:text>
          </xsl:when>
          <xsl:when test="contains(@style, 'bold')">
            <xsl:text>\textbf{</xsl:text>
            <xsl:value-of select="."/>
            <xsl:text>}</xsl:text>
          </xsl:when>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates mode="output-latex"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

How's that??

One problem with the above, though, is how to handle something like this:

<span style="font-weight: bold; font-style: italic;">Some Title</span>

.... where the output -- I'm pretty sure -- should be nested latex inlines. Any ideas?

Bruce

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.