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

Re: Manipulating XSL element

Subject: Re: Manipulating XSL element
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 14 Aug 2000 19:21:24 +0100
xsl create tag from content
Ciaran,

>	Is there any way to create an XML element
>without it being created by my XSL as an empty tag i.e.
><element/>

[You're still working on your XML parser in XSL, then?  It is still a bad
idea.  The more XML-like functionality you put in your pseudo-XML strings,
the worse an idea it gets.]

The only difference between an empty element and a non-empty element is
that an empty element has some content.  When you create an element using
xsl:element, then anything that you put within the xsl:element (that aren't
attributes) becomes its content.  For example:

<xsl:element name="tag">
  This is the content.
</xsl:element>

gives the output:

<tag>This is the content.</tag>

In your input pseudo-XML, you have the string coming in that looks like:

  "<tag>This is the content.</tag>"

***Note for confused readers: that <tag> and </tag> are not actually
openning and closing tags, the whole thing is a text string held in an
attribute value.***

You will need, in your XSLT-based XML parser, to look at the whole element
at once.  XSLT cannot create start tags and end tags separately, it creates
elements as a whole.  You need to write some XSLT code that looks at the
string and if the first bit is '<' + a name + '>', then take the substring
from the beginning of the string to the bit in the string that is '</' +
the name + '>', and process it to produce an element with the relevant
content.  The problem is that if you have nested pseudo-elements with the
same name then you need something so much more sophisticated that it is
nigh-on impossible.

I feel that offering any more assistance than that would be like
encouraging you to go down a road that I know ends in a cliff.  You should
not be writing an XML parser in XSLT.  It's an interesting theoretical
challenge, but it's just completely unnecessary.

Sorry,

Jeni


 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.