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

RE: Using a pre-processor for dynamic inputs

Subject: RE: Using a pre-processor for dynamic inputs
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 13 Sep 2004 12:14:01 -0400
piez robin
At 05:21 AM 9/11/2004, Mike wrote:
(a) if the inputs are fairly predictable in structure, you can write your
stylesheet to interpret the inputs. For example, you might supply a
parameter to the stylesheet of the form:

<conditions>
  <condition>
    <attribute>name</attribute>
    <value>robin</value>
  </condition>
  <condition>
    <attribute>size</attribute>
    <value>small</value>
  </condition>
</conditions>

Since the OP is a newbie, I hasten to add that simple cases of this are often handled with string-valued parameters, not node-trees, so you could say for example


saxon in.xml stylesheet.xsl name='robin' size='small'

and get the same effect. It's easy to do, requires a little less overhead, and (like the more complex solution) binds the values at run-time, when they're required.

It was also subsequently written:
Or even better, put the condition in the match pattern:

  <xsl:template
   match="Species[Extinct='False' and Genus_Name='Casuarius']">
      <p>species name is <xsl:value-of select="Species_Name"/></p>
  </xsl:template>

<xsl:template match="Species"/>

Yeah, I should have explained this is what I wanted, but couldn't get it to work right (because I didn't have the second template)!

But unfortunately, match patterns like match="Species[Extinct=$extinct and Genus_Name=$name]" aren't legal in XSLT 1.0 (no variable or parameter references allowed there), so you're back to the in-template conditional test....


Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--

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.