xsl-list
[Top] [All Lists]

RE: [xsl] Simple Question

2007-01-31 02:56:32
It's actually a pretty deep question, though a very common one among
beginners.

XSLT doesn't "print out XML". It creates nodes in a result tree. The result
tree is subsequently (and optionally) passed to a serializer, which "prints
out" an XML representation of the tree. The problem isn't so much that your
code is invalid XML, as that it shows a misunderstanding of the XSLT
processing model.

When you see in a stylesheet

<a>....</a>

that isn't an instruction to output a start tag, then do something (....),
then output an end tag. It's a single indivisible instruction to output an
element node named a, whose children are determined by the value of the
expression (....). Later on, if you choose to serialize the result tree, the
serializer looks at the element node and serializes it using a start tag and
an end tag.

As we've often remarked on this list, you can't create half a node. 

Michael Kay
http://www.saxonica.com/



-----Original Message-----
From: Punnoose, Roshan [mailto:punnooser(_at_)bah-systems(_dot_)com] 
Sent: 30 January 2007 20:56
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Simple Question

I know that this is a really simple question but I just can't 
seem to figure it out. I want to print out xml if a certain 
condition is true, so I thought the bottom would work, but of 
course it isn't valid xml.
Any ideas?

      <xsl:if test="$a != $times">
              <xqx:orOp>
                      <xqx:firstOperand>      
      </xsl:if>

Roshan Punnoose
Phone: 301-497-6039


--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>