[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: dynamically generating 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 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|