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

Re: dynamically applying templates

Subject: Re: dynamically applying templates
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Wed, 15 Sep 2004 13:14:47 -0400
source mods
On Sep 15, 2004, at 11:46 AM, Wendell Piez wrote:

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

==== config ==== <citationstyle xmlns="http://xbiblio.sourceforge.net/xcs"> <content> <bibliography author-as-sort-order="yes"> <entry> <reftype name="book"> <title font-style="italic" after=", "/> <creator/> </reftype> </entry> </bibliography> </content> <citationstyle>

==== source ====

<doc>
<!-- this would normally be docbook ng; but keep it simple for now -->
   <mods xmlns="http://www.loc.gov/mods/v3">
     <name type="personal">
        <namePart type="given">Jane</namePart>
        <namePart type="family">Doe</namePart>
     </name>
     <titleInfo>
        <title>Main Title</title>
        <subTitle>Subtitle</subTitle>
     </titleInfo>
   </mods>
</doc>

==== xsl ====

<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:db="http://docbook.org/docbook-ng"
                xmlns:mods="http://www.loc.gov/mods/v3"
                xmlns="http://www.w3.org/1999/xhtml"
		xmlns:bib="http://xbiblio.sourceforge.net/xbib"
		xmlns:cs="http://xbiblio.sourceforge.net/xcs"
                exclude-result-prefixes="mods db bib xs cs">

<xsl:output method='xhtml' encoding='utf-8' indent='yes'/>

<xsl:strip-space elements="*"/>

<!-- read the external citation style file -->
<xsl:param name="citation-style" required="yes" as="xs:string" />

<xsl:variable name="styles" as="document-node()"
  select="doc(concat($citation-style, '.csl'))" />

<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[@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:stylesheet>

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.