[xslt] Beginner XSLT/xsltproc question.
- From: sudhakar+xslt CS Princeton EDU
- To: xslt gnome org
- Subject: [xslt] Beginner XSLT/xsltproc question.
- Date: Wed, 5 Jan 2005 22:26:37 -0500 (EST)
Hi all,
I am a newbie for XML/XSLT/xlstproc. I am running into trouble
with my first program. I will be glad if someone can help me write the
XSLT file. I read http://www.w3.org/TR/xslt . But I am missing
something.
This is the node hierarchy:
oval-->definitions-->definition.
For some reason, I am not able to write a for-each rule to select
the "definition" nodes. The following code ilustrates the problem I am
running into.
<xsl:template name="definitions">
Node name is
<xsl:value-of select="name()"/>
<xsl:call-template name="newline"/>
<!-- This does *not* work. Why? -->
<xsl:for-each select="definition">
DEFINITION node
<xsl:value-of select="name()"/>
<xsl:call-template name="newline"/>
</xsl:for-each>
<!-- This works -->
<xsl:for-each select="*">
STAR node
<xsl:value-of select="name()"/>
<xsl:call-template name="newline"/>
</xsl:for-each>
</xsl:template>
The output is:
Node name is definitions
STAR node definition
I would have expected the xsltproc to print "DEFINITION node" too.
Am I missing something? The complete files can found here:
style sheet:
http://www.cs.princeton.edu/~sudhakar/scratch/xml/gnome/new.xsl
XML file:
http://www.cs.princeton.edu/~sudhakar/scratch/xml/gnome/small-redhat.definitions.xml
output:
http://www.cs.princeton.edu/~sudhakar/scratch/xml/gnome/output.html
thanks in advance,
Sudhakar.
22:12:12]opus::~/p/xml/gnome $ xsltproc -V
Using libxml 20510, libxslt 10033 and libexslt 722
xsltproc was compiled against libxml 20510, libxslt 10033 and libexslt 722
libxslt 10033 was compiled against libxml 20510
libexslt 722 was compiled against libxml 20510
[22:12:15]opus::~/p/xml/gnome $
Command line used:
xsltproc --output output.html new.xsl small-redhat.definitions.xml
Sudhakar Govindavajhala Department of Computer Science
Graduate Student, Princeton University
Ph : (lab) +1 609 258 1763 (office) +1 609 258 1798
http://www.cs.princeton.edu/~sudhakar
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]