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]

Re: Document() Problem:




] <xsl:variable name="xml" select="document('names.xml')//root"/>
the // there makes the processor search the entire document for all
elements called root, and return all of them. You know there's only one,
at the top, but it doesn't:


<xsl:variable name="xml" select="document('names.xml')/root"/>

would be quicker.
(by the way it's really confusing to call the document element "root"
as it confuses the issue with the document root (/) which is something
else entirely)


} <xsl:value-of select="$xml/name/."/>

<xsl:value-of select="$xml/name"/>

would select all  the name elements, which is what I think you want.
but then as you use value-of it will take th estring value of the node
set which is the string value of the first node in the set in document
order, ie just the first name.

Perhaps you want

<xsl:value-of select="$xml"/>
the string value of the (single element node, root) is the concatenation
of the values of its children, ie all th enames.

or more likely you want
<xsl:apply-templates select="$xml/name"/>
or for-each, to do something with th enames individually.

> I get null + the number of elements/attributes.
This doesn't make sense, null isn't an XSL value, what do you get?

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 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]