Subject: Re: [xsl] dynamically generating css From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx> Date: Wed, 1 Sep 2004 07:24:33 -0400 |
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!
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?
<!-- 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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Performance problems with, David Carlisle | Thread | [xsl] Creating lists and sublists f, Andrew Brothwell |
Re: [xsl] Performance problems with, David Carlisle | Date | Re: [xsl] Sorting and replacing con, Kenny Bogoe (BogoeMD |
Month |