[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

numbering output and other newbie issues

Subject: numbering output and other newbie issues
From: Terry Ofner <tofner@xxxxxxxxxxx>
Date: Fri, 24 Feb 2006 15:19:23 -0500
xml exercises for newbie
I am a newbie to xsl stylesheets as well as xml. I have set myself a specific task as my first "assignment." I have a set of English grammar exercises for which I want to build an answer key. The exercises are not in XML format yet, so I have control over the XML format as well as the XSL stylesheet.

Here is my first trial XML document.

<?xml version="1.0" encoding="UTF-8"?>
<Story>
<chapter>The Sentence Base?</chapter>
<GrammarTopic>Finding Subjects</GrammarTopic>
<Directions>Underline the subject in each sentence. If the subject is an understood you, write you.</Directions>
<GrammarQuiz>
<Item>1. Find your seats quickly. <Answer>you</Answer></Item>
<Item>2. During open auditions there are very few empty <Answer>seats</Answer> in the auditorium.</Item>
<Item>3. Have <Answer>you</Answer> heard the director's name?</Item>
</GrammarQuiz>
</Story>


And here is the stylesheet.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">
<xsl:copy-of select="Story/GrammarQuiz/Item/Answer" />

</xsl:template>
</xsl:stylesheet>

The result is:

<?xml version="1.0" encoding="utf-8"?><Answer>you</Answer><Answer>seats</Answer><Answer>you</Answer><Answer>actress</Answer><Answer>director</Answer>

This result is okay, but I would like to number each answer. I have tried to add this line after the copy-of select line:

<xsl:number count="*" format="1. "/>

This line does not change the output.

There are other anomalies (or what appear to me to be anomalies.) For example, when I change copy-of select to value-of select I get this output:

<?xml version="1.0" encoding="utf-8"?>you.

I am using SAXON 6.5.4 on a Windows laptop. I have tried the same on Mas OS X with XSLT Tester with the same result-- which only proves that it is my stylesheet that is at fault (along with my thinking).

Any help would be appreciated.

Terry

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.