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

RE: Chapter 14 of the XML Bible now online

Subject: RE: Chapter 14 of the XML Bible now online
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 21 Jul 1999 09:35:08 +0100
bible chapter that contains pi
>The select attribute uses the same kind of patterns as the match attribute
of the xsl:template element. 

I'd be inclined to be clear that this point that expressions and patterns
are not the same thing though they look very similar.

>If no select attribute is present, all child elements are selected.

No, all child nodes.

>The xsl:value-of element copies the value of a node in the input document
into the output document.

Only if what you give it is a nodeset expression. If you give it, say, a
count() function, it outputs that instead.

>The value of this element is shown below:


  Hydrogen
  H    
  
You're making the assumption here that whitespace nodes aren't being
stripped. 

><xsl:template match="//ATOMIC_NUMBER">

"//" at the beginning of a pattern is noise, it doesn't alter the value of
the pattern. (The same isn't true of an expression, however).

>The test brackets can contain more than simply a child element name. In
fact, they can contain any select expression. 

Actually, any expression. There's no such thing as a select expression any
more, the nearest thing is a nodeset expression. But the predicate is
actually evaluated as either a boolean or an integer.

>One type of pattern testing that proves especially useful is string
equality. An equals sign (=) can test whether the value of a node
identically matches a given string. 

It was limited to that a couple of drafts ago but is now much more powerful.

>A node set is a list of nodes from the input document

Well actually it's a set of nodes! It becomes a list (in document order)
when you process it using xsl:for-each or xsl:apply-templates. Operations
like union treat it as a set, eliminating duplicates.

>The same template rule could be written using the not equal operator !=
instead:

Yes in this case. But when nodesets are involved, x!=y doesn't mean the same
as not(x=y). It means (exists x1 in x, y1 in y : x1 != y1). Also note that
the meaning of "=" has changed in the latest draft: if an attribute ATT is
absent, then @ATT="" was true in the last draft, but is false now; and
@ATT!="" is also false; but not(@ATT="") is true. (Personally, I wish they'd
gone for SQL-style 3-valued logic)

>XSL provides the standard four arithmetic operators:

+ for addition 
- for subtraction 

remember that the - may need a space before it to avoid it being swallowed
into a name, e.g. a-b is a single hyphenated name, not a subtraction!

>Node sets are converted by concatenating the values of the nodes in the
set. 

No, it takes the value of the first node (in document order) and ignores the
others.

>. This is accomplished by using of xsl:element, xsl:attribute, xsl:pi,
xsl:comment, and xsl:text elements

xsl:pi has been renamed.

>you can use any of the string expressions discussed earlier in an attribute
value template

Actually, any expression, not just a string expression.

><xsl:attribute name="HREF">
      <xsl:value-of select="SYMBOL"/>.html
    </xsl:attribute>
    
I'd encourage people to avoid leading and trailing whitespace in attribute
values, it can cause confusion.

>A style sheet in which multiple attribute sets of the same importance
define the same attribute is in error.

I don't think so. Not my reading of the spec anyway.

>Generating Processing Instructions with xsl:pi

xsl:processing-instruction
And it's probably worth mentioning that the xml declaration isn't a PI, even
though Microsoft think otherwise.

>The xsl:number element inserts a formatted integer into the output document
Or a list of integers (level=multiple)

>For example, to start numbering at 5, set format="5". 
An interesting reading of the spec. I read it differently, but I can't
disagree. It basically says the implementation can do what it likes!

>Standard XSL contains no means to insert raw, unescaped < characters that
are not part of a tag into the output. 
Inserting ampersands can also be a problem, e.g. to create URLs.

>The xsl:variable element defines a named string 
Not just a string. Named node-sets can be very useful and are often
overlooked.
(By the way, your font has gone wrong at this point. And I get the
impression you were getting a bit tired by the time you wrote the tail end
of this chapter - can't blame you!).


Do give SAXON a mention!

Mike Kay

I first sent this to Elliotte off-list but it bounced.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.