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

Re: regexs, grouping (?) and XSLT2?

Subject: Re: regexs, grouping (?) and XSLT2?
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Wed, 11 Aug 2004 10:11:02 -0400
Re:  regexs
OK, going back to this:

On Aug 10, 2004, at 11:10 AM, Bruce D'Arcus wrote:

I'd really like to make the stylesheet configurable via an XML style
file.  The style file would basically define variables, lay them out
in the appropriate order, and give instructions on surrounding
punctuation.  Think BibTeX .bst files, but in XML.

So a layout for a book might look like (there'd also be other stuff
that defines how to format names, lists of terms to use for thing like
editors, and media, etc.):

	<reftype name="book">
	  <creator/>
	  <date before=" (" after=") ">
	    <year/>
	  </date>
	  <title font-shape="italic" after=", "/>

I decided to make things simpler and just make the stylesheet configurable internally, and then maybe later I can worry about reading an external (XML) configuration file.

Does the below seem like the right approach?  And conceptually how do I
think about reading a non-xsl file and getting the xslt to apply the
below logic?

<!-- begin configuration options -->

<!--
biborder template called by main bib template to determine order of
processing
Note: this of course leaves the author-year ordering fixed; not a
problem now, but would be
if I want to allow greater configuration options.
-->

<xsl:template name="biborder">
  <xsl:apply-templates select="mods:titleInfo"/>
  <xsl:apply-templates select="mods:originInfo"/>
  <xsl:apply-templates select="mods:relatedItem"/>
  <xsl:apply-templates select="mods:location"/>
</xsl:template>

<!-- punctuation variables -->

<xsl:variable name="title-before">
  <xsl:text></xsl:text>
</xsl:variable>

<xsl:variable name="title-after">
  <xsl:text> </xsl:text>
</xsl:variable>

<xsl:variable name="year-before">
  <xsl:text>(</xsl:text>
</xsl:variable>

<xsl:variable name="year-after">
  <xsl:text>) </xsl:text>
</xsl:variable>
<xsl:variable name="creator-before">
  <xsl:text></xsl:text>
</xsl:variable>

<xsl:variable name="creator-after">
  <xsl:text> </xsl:text>
</xsl:variable>

.... etc.

Bruce

PS - I get the same weird virus warning as Mike.

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.