On Fri, 2004-05-28 at 05:09, Geoff Capper wrote:
> Hi all,
>
> First thanks for creating and maintaining XML:XSLT, it's great! My
> apologies if posting attachments is frowned upon, please let me know the
> correct procedures.
>
Well as you will have seen it will cause some delay to your message
reaching the list, this compounded by the fact that I had forgotten the
list admin password.
Ideally we would get changes as a patch to the latest version of the
file from the CVS (or just made and committed to the CVS .)
> I have altered the module to implement the name() and local-name()
> functions, though the name() implementation doesn't support a node-set
> yet, the local-name() does, and it doesn't break any of your tests.
>
SOunds good - but do you have a test to support it :-) Seriously, thanks
for this I am always happy to have functionality supported.
> My question is related to the following (it may be that I lack enough
> knowledge of XSLT and that my mistake is therefore in this rather than
> the implementation of the function.):
>
> If I have xml such as:
>
> <structure>
> <nucleus>
> <protons>1</protons>
> <neutrons>0</neutrons>
> </nucleus>
> </structure>
>
> and an xsl template:
>
> <xsl:template match="structure">
> <xsl:value-of select="local-name(nucleus/*[0])"/>
> </xsl:template>
>
> it returns "neutrons" wheras if my template says:
>
> <xsl:value-of select="local-name(nucleus/*)"/>
>
> it will return "protons"
>
> Is this an error in my understanding of xslt or just the way I have
> implemented the function? Shouldn't /* and /*[0] both refer to the first
> child in this context (the xpath spec says just act on the first child
> for this function)
>
I think this should be the other way round, I think the unqualified *
will return the last value and the qualified should return the first (or
whichever index it has). Usually the way I sort this out is try it with
some other xslt processor or two to see what they do - if I get a minute
I'll try xsltproc and sabcmd, though this is unlikely before next week.
> Also, if these additions are in accordance with the specs and useful,
> are they in the right place? Should any changes be made to add them to
> the module?
>
As I say, ideally we would get them as a patch and with tests that can
be placed in the t/ directory of the distribution - you will probably
find some example xml, xslt and result in the NIST test suite.
Alternatively I could make you a developer on the project and you could
commit the changes to CVS yourself - of course you will still have to
make the tests :-) Mail me off-list with your sourceforge id if you
want to sign-up.
Thanks again for the work.
/J\
|