[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: dynamically applying templates
Bruce,
Sorry this is proving to be so cryptic. At 04:44 PM 9/13/2004, you wrote: On Sep 13, 2004, at 2:16 PM, Wendell Piez wrote: Unless you have mods:titleInfo elements somewhere in your input (either in the source file or in a configuration) ... no. Select the config template and perform the mapping you want: <xsl:template match="cs:title[parent::reftype/@name='book' and ancestor::bibliography/@author-as-sort-order='yes'> <mods:titleInfo> Creates whatever output you want for this kind of title here; make generic, if you like, by including values of @after and so forth in place of literals.... </mods:titleInfo> </xsl:template> where the node you are matching is in your config file: <bibliography author-as-sort-order="yes"> <entry> <reftype name="book"> <title font-style="italic" after=", "/> [etc.] </reftype> </entry> </bibliography> <xsl:template match="cs:title"> <xsl:apply-templates select="//mods:titleInfo" mode="bib"/> </xsl:template> ... <xsl:template match="mods:titleInfo" mode="bib"> <span class="title"> <xsl:apply-templates/> </span> </xsl:template> This won't work because that second template is not a mods:titleInfo element, and it won't ever be processed as such. It will only be applied if a mods:titleInfo node somewhere is selected (in mode 'bib'). (You could select a node from the stylesheet itself for processing, but any node addressed as "//mods:titleInfo" is going to be in the primary source; plus it's got the wrong name.) Now of course, since you're using XSLT 2.0, you do have the option of *creating* a mods:titleInfo, and then processing that however you like ... that's a technique you've already seen: <xsl:variable name="style-citation"> <xsl:apply-templates select="$styles/cs:citationstyle/cs:content/cs:citation"/> </xsl:variable> <xsl:apply-templates select="$style-citation" mode="bib"/> where <xsl:template match="cs:citation"> <mods:titleInfo> ... </mods:titleInfo> </xsl:template> gives you a mods:titleInfo to process, and a template matching mods:titleInfo is then invoked by the apply-templates after the variable binding.... Maybe you're already doing this, and the approach is obvious ... if so, please forgive the intrusion. I hope that helps. Cheers, Wendell
|
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
|