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

RE: Simple Question

Subject: RE: Simple Question
From: "Punnoose, Roshan" <punnooser@xxxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2007 08:51:43 -0500
RE:  Simple Question
Thanks for the replies. I'm better understanding how XSLT works and with
a little help able to get this to work:

<xsl:if test="$a != $times">
 		<xsl:text
disable-output-espacing="yes">&lt;xqx:orOp&gt;</xsl:text>
 			...
 	</xsl:if>

Of course, there are problems in this too, but I'm working them out.

The reason I had to do it this way is because I'm working on a recursive
loop that prints out a binary node tree, which I sort of needed this
for. (Though there probably is a way to do it a little cleaner.)

Thanks!

Roshan Punnoose
Phone: 301-497-6039

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Wednesday, January 31, 2007 4:56 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Simple Question

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@xxxxxxxxxxxxxxx]
> Sent: 30 January 2007 20:56
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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

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.