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

Re: dynamically generating css

Subject: Re: dynamically generating css
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Wed, 1 Sep 2004 07:24:33 -0400
bibliography css
On Aug 31, 2004, at 9:05 AM, Jeni Tennison wrote:

What I suggest is that you turn your stylesheet inside-out. Instead of
working from the top down to the elements that you want to create
styles for, work from those elements up to their ancestor <cs:reftype>
element in order to create the CSS class names.

That makes sense. I was just not seeing how to do that, but your example helps clarify it!

That problem's now solved.

My second customization problem will sound familiar, but basically I
want to read the external file to set the order of processing.  So, my
file may have:

<creator>
  <name/>
  </role>/
</creator>
<year/>
<title/>
<container> <!-- maps to mods:relatedItem[@type='host']
  <title/>
</container>

And then I want to use that as the template for the layout.  My
question, is, do I need to somehow rethink the structure of the below
sort of template?  If so, how?

I have a specific commented question towards the bottom of the template.

<!-- take processed biblist and run templates on them in bib mode, with
different templates
for each primary citation class (author-year, footnote, numbered, etc.)
-->
<xsl:template
match="mods:modsCollection[$citation-class='author-year']"
mode="bibliography">
  <xsl:variable name="first" as="xs:boolean" select="position() = 1" />
  <xsl:variable name="author-name" select="bib:grouping-key(.)"/>
  <xsl:for-each-group select="mods:mods" group-by="bib:grouping-key(.)">
    <xsl:for-each select="current-group()">
      <xsl:variable name="first" as="xs:boolean" select="position() =
1" />
      <p class="bibref" id="{@ID}">
	<xsl:value-of select="$bibref-before"/>
	<span class="creator">
	  <xsl:choose>
	    <xsl:when test="count(current-group()) = 1">
	      <xsl:choose>
		<xsl:when test="not($first and position() = 1)">
		  <xsl:text>.</xsl:text>
		</xsl:when>
		<xsl:otherwise>
		  <xsl:choose>
		    <xsl:when test="mods:name">
		      <xsl:apply-templates select="mods:name" mode="bibliography"/>
		    </xsl:when>
		    <xsl:otherwise>
<!-- if no author name, substitute periodical name, or "anonymous";
generated in temporary tree-->
		      <xsl:value-of select="mods:noname-substitute"/>
		    </xsl:otherwise>
		  </xsl:choose>
		</xsl:otherwise>
	      </xsl:choose>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:choose>
		<xsl:when test="mods:name">
		  <xsl:apply-templates select="mods:name" mode="bibliography"/>
		</xsl:when>
		<xsl:otherwise>
		  <xsl:value-of select="mods:noname-substitute"/>
		</xsl:otherwise>
	      </xsl:choose>
	    </xsl:otherwise>
	  </xsl:choose>
	</span>
<!--
I think all the way up to here is general across all author-year
styles.  So the question
is how do I make the remaining processing order configurable.  Do I
want to create here
another template similar to the CSS one that handles this and then just
call it here?

If yes, then do I need to do something similar for the children
templates (like mods:relatedItem)?
-->
	<xsl:apply-templates select="mods:year"/>
	<xsl:apply-templates select="mods:titleInfo[not(@type='abbreviated')]"
			     mode="bibliography"/>
	<xsl:apply-templates select="mods:originInfo" mode="bibliography"/>
	<xsl:apply-templates select="mods:relatedItem" mode="bibliography"/>
	<xsl:apply-templates select="mods:location" mode="bibliography"/>
	<xsl:value-of select="$bibref-after"/>
      </p>
    </xsl:for-each>
  </xsl:for-each-group>
</xsl:template>

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.