Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] dynamically generating css

From: Bruce D'Arcus <bdarcus@------------->
To:
Date: 9/1/2004 11:26:00 AM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent