Hi,
In XSLT1.0, are these two match expressions not supposed to match the
same nodes:
child::foo
and
foo
?
As I can read the grammar for match expression in the spec, child:; is
implied when there is no / or // at the beginning, and no exlpicit axis.
-- but my xsltproc behaves differently with and without the child:: !
Where is the bug.. ?
Soren 5 1295
Soren Kuula <do******@daimi.au.dk> writes: Hi,
In XSLT1.0, are these two match expressions not supposed to match the same nodes:
child::foo
and
foo
?
As I can read the grammar for match expression in the spec, child:; is implied when there is no / or // at the beginning, and no exlpicit axis.
-- but my xsltproc behaves differently with and without the child:: !
Where is the bug.. ?
somewhere that you haven't shown us. What different behaviour do you
see?
child::foo and foo are equivalent in XPath expressions an in XSLT match
patterns.
David
Hi,
All right I neglected the example. Here is one:
Input doc:
[dongfang@granada xslt-examples]$ cat position-fun.xml
<?xml version='1.0'?>
<warehouse>
<item name="foo">
<country>Argentina</country>
</item>
<item name="bar">
<country>Brazil</country>
</item>
<item name="baz">
<country>China</country>
</item>
1st stylesheet:
[dongfang@granada xslt-examples]$ cat position-fun21.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match='warehouse'>
<position-experiment>
<first-try>
<xsl:apply-templates select='item/country | text()'/>
</first-try>
</position-experiment>
</xsl:template>
<xsl:template match='country[1]'>
<first-country>
(with "first", we mean: <xsl:value-of select="position()"/>)
<xsl:copy-of select='.'/>
</first-country>
</xsl:template>
<xsl:template name="notfirst" match='country'>
<xsl:copy-of select='.'/>
</xsl:template>
</xsl:stylesheet>
Output:
[dongfang@granada xslt-examples]$ xsltproc position-fun21.xsl
position-fun.xml
<?xml version="1.0"?>
<position-experiment>
<first-try>
<first-country>
(with "first", we mean: 2)
<country>Argentina</country></first-country>
<first-country>
(with "first", we mean: 4)
<country>Brazil</country></first-country>
<first-country>
(with "first", we mean: 6)
<country>China</country></first-country>
</first-try>
</position-experiment>
2nd stylesheet: Only difference is addition of child:: in match exp
[dongfang@granada xslt-examples]$ cat position-fun22.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match='warehouse'>
<position-experiment>
<first-try>
<xsl:apply-templates select='item/country | text()'/>
</first-try>
</position-experiment>
</xsl:template>
<xsl:template match='child::country[1]'>
<first-country>
(with "first", we mean: <xsl:value-of select="position()"/>)
<xsl:copy-of select='.'/>
</first-country>
</xsl:template>
<xsl:template name="notfirst" match='country'>
<xsl:copy-of select='.'/>
</xsl:template>
</xsl:stylesheet>
Output:
[dongfang@granada xslt-examples]$ xsltproc position-fun22.xsl
position-fun.xml
<?xml version="1.0"?>
<position-experiment>
<first-try>
<country>Argentina</country>
<country>Brazil</country>
<country>China</country>
</first-try>
</position-experiment>
[dongfang@granada xslt-examples]$
Some difference there.
As I get it, they should have been identical??
Soren
And:
[dongfang@granada xslt-examples]$ xsltproc --version
Using libxml 20606, libxslt 10033 and libexslt 722
xsltproc was compiled against libxml 20511, libxslt 10033 and libexslt 722
libxslt 10033 was compiled against libxml 20511
libexslt 722 was compiled against libxml 20511 As I get it, they should have been identical??
yes, they should.
David
David Carlisle wrote: As I get it, they should have been identical??
yes, they should.
David
Thanks David,
Getting confused is not that bad after all then, when what you are
trying to convince yourself about is wrong....
Soren This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Design Pattern Catalog |
last post by:
Thank you for your interest in "Design Patterns: Elements of Reusable
Object-Oriented Design", by Erich Gamma, Richard Helm, Ralph Johnson,
and John Vlissides. This message answers several...
|
by: Steve Jorgensen |
last post by:
In a schema I've been working on recently, a convention I evolved was to use a
consistent naming pattern such that, for instance, a Resident could appear in
a ResidentSet, and could be referred to...
|
by: John Salerno |
last post by:
Here are a few I'm considering:
Design Patterns Explained : A New Perspective on Object-Oriented Design
(2nd Edition) (Software Patterns Series) by Alan Shalloway
Design Patterns C# by...
|
by: Jeff |
last post by:
I'm just getting up to speed on OOP patterns (e.g, MVC) and I'm wondering
how closely they are followed out in the real world. Do those of you who use
them try to follow them as closely as possible...
|
by: JosAH |
last post by:
Greetings,
this week we let go of all that algebraic stuff and concentrate a bit more on
what object oriented programming is all about. Java claims to support OO, so
why not use it? In this...
|
by: =?Utf-8?B?bWF2cmlja18xMDE=?= |
last post by:
Hi,
I would like to know more about design patterns and specifically using C#.
Can any one recommend a good book?
Thanks
|
by: weaknessforcats |
last post by:
Design Patterns – State
Often computer software operates based on a condition called a state. These states traditionally have been implemented using a switch statement. The cases of the switch...
|
by: Christian Hackl |
last post by:
Hi!
I've got a design question related to the combination of the NVI idiom
(non-virtual interfaces, ) and popular object-oriented patterns such
as Proxy or Decorator, i.e. those which have the...
|
by: John Sheppard |
last post by:
Hello,
I am working on a 3teired project, data,bizlogic, userinterface...I have a
global class that at current is being passed around as parameters, this is,
to say the least messy...
I am...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |