xsl-list
[Top] [All Lists]

Re: XML reformatting <xsl:element & <xsl:for-each

2003-01-07 07:49:41

but It keeps saying that the element name is not a
QName, How can I accomplish this???

the name attribute of xsl:element is by default the literal name 9qname)
of the element to be generated.
<xsl:element name="name()">
is generating <name()> which isn't allowed.

To get Xpath expression to evaluate to the name you need to use {} as in
<xsl:element name="{name()}">
however

                <xsl:element name="{name()}">
                        <xsl:value-of select="current()/text()"/>
                </xsl:element>
is just making a copy of the current element so it would be simpler to
replace those lines by

<xsl:copy-of select="."/>



        <xsl:text>
                <xsl:value-of select="current()/text()"/>
        </xsl:text>

generates an error as you can not have any elements inside xsl:text
so this error isn't odd:
I'm also getting Odd errors about <xsl:text>, 'Unexpected  Child'.
It is complaining about teh xsl:value-of.

You could just do without the xsl:text
<xsl:value-of select="current()/text()"/>
which is equivalent to
<xsl:value-of select="text()"/>
or in this case, as the element has no child nodes,
<xsl:value-of select="."/>

however looking at your required output you don't want any text output
before the elements so you can delete these lines.

I didn't understand your description of how the required result shoul
dbe derived from the example input so I'm not sure what else you'll need
to change but your stylesheet doesn't have anything processing the
table1 and table2 elements in your source.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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