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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--