xsl-list
[Top] [All Lists]

Re: dynamically applying templates

2004-09-15 08:46:34
Bruce,

Could you include a snippet of source (actually both sources) so we have a clue as to what the input looks like?

I know it should be available in my email archive, but it's scattered and I don't really have the time to patch it together. Please make it easy for me to help!

I can tell from looking at the code that you're going to have trouble here, since at the root, you apply templates in mode "bibliography", but (a) I don't know what child(ren) of the root you have (and thus what templates it would match), and (b) I see no templates here in that mode in any case.

Yet not knowing what the input looks like, it's impossible for me to say what would work.

We find it easiest to answer questions which are well-enough encapsulated to present the entire problem in a neat package. That is, reduce the problem to its essentials (important so we don't have to wade through screens and screens of code) and present the list with (a) sample source, (b) XSLT code, (c) output you're getting (so we don't have to run it ourselves and/or can diagnose whether you may be dealing with a processor bug), and (d) output you want.

Cheers,
Wendell

At 09:04 PM 9/14/2004, you wrote:

On Sep 14, 2004, at 4:27 PM, Wendell Piez wrote:

I'm going to leave the deeper look-see for later (being rather snowed myself), if you don't mind, and hope that the correction above will confirm that you're on the right track....

I don't mind.

I'm getting closer.  I now get:

<html xmlns="http://www.w3.org/1999/xhtml";>
   <div>JaneDoeMain TitleSubtitle</div>
</html>

Which suggests some of the templates are matching. But clearly not all of them are, and the crucial order business is wrong (title should come before name here). I'm guessing the problem is in one or both of the first two templates.

<xsl:variable name="style-biblio" select="$styles/cs:citationstyle/cs:content/cs:bibliography"/>

<xsl:template match="/">
  <xsl:param name="source"/>
  <html>
    <div>
      <xsl:apply-templates mode="bibliography">
        <xsl:with-param name="source" select="$style-biblio"/>
      </xsl:apply-templates>
    </div>
  </html>
</xsl:template>

<xsl:template match="cs:entry/cs:reftype[(_at_)name='book']" 
mode="bibliography">
  <xsl:param name="source"/>
  <test>
    <xsl:apply-templates>
      <xsl:with-param name="source" select="$source"/>
    </xsl:apply-templates>
  </test>
</xsl:template>

<xsl:template match="cs:title">
  <xsl:param name="source"/>
  <xsl:apply-templates select="$source/mods:titleInfo" mode="full"/>
</xsl:template>

<xsl:template match="mods:titleInfo" mode="full">
  <span class="title">
    <xsl:apply-templates select="mods:title"/>
    <xsl:apply-templates select="mods:subTitle"/>
  </span>
</xsl:template>

<xsl:template match="cs:creator" mode="full">
  <xsl:param name="source"/>
  <xsl:apply-templates select="$source/mods:name" mode="full"/>
</xsl:template>

<xsl:template match="mods:name" mode="full">
  <span class="creator">
    <xsl:apply-templates select="mods:namePart"/>
  </span>
</xsl:template>


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================