This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

xsl:element


Gordon Stewart writes:
 > Hi List
 > 
 > can anyone explian in clear english how xsl:element works?

Since the people who are really "in the know" havn't answered yet,
I'll take a stab at it.

XSLT is all about transforming an input XML document tree into an
output document tree.  XML trees have several different kinds of
nodes, among them are element nodes, attribute nodes and text nodes.
<xsl:element ...> adds an element to the output tree.  Putting 

    <xsl:element name="foo">
        This is a foo element
    </xsl:element>

in a transform causes that transform to add a single element, "foo" to
the output tree.  This element has a single child which is a text
node.  Note that this example is no different from 

    <foo>
        This is a foo element
    </foo>

The power of xsl:element is that it allows both the name of the
element and its namespace to be computed in an XPath expression, so if
the element to be generated might be one of several different
types/names, you can do

    <xsl:element name="{$element_name}>
        This is a foo element
    </xsl:element>

to generate an element whose name is that specified by the value of
the previously defined variable "el;ement_name".

 > I have look on the zvon site and http://www.dpawson.co.uk/ and I am sill
 > confused.

What are you connfused about?


 > Are there any well written documentation on XSLT?

I use:

    The spec:

        http://www.w3.org/TR/xslt

    Michael Kay's book:

        http://www.amazon.com/exec/obidos/ASIN/1861005067/qid=1001076510/sr=1-1/ref=sr_1_6_1/103-7648004-0059808



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]