xsl-list
[Top] [All Lists]

[xsl] enclosing siblings in an element

2008-01-23 15:27:06
I am a bit stuck on this one. After converting a Word document to rtf and using upCast I end up with a "flat" structure such as this:
<document>
<part>
<par class="stem_mc">&#9;1&#9;Read the sentence. Then choose the best synonym to replace the boldfaced word.</par> <par class="display">The threat of rain makes it <inline style="font-weight: bold;">dubious</inline> that the game will go on as scheduled.</par>
    <par class="choice-a">&#9;A&#9;doubtful</par>
    <par class="choice-b">&#9;B&#9;likely</par>
    <par class="choice-c">&#9;C&#9;hopeful</par>
    <par class="choice-d">&#9;D&#9;obvious</par>
    <par class="Answer">A</par>
    <par class="g_code">G5U1S5</par>

<par class="stem_mc">&#9;2&#9;As used in the sentence below, what is the denotation of the word <inline style="font-style: italic;">mutt?</inline></par> <par class="display">“What is that mutt doing in our yard?” asked Dad.</par>
    <par class="choice-a">&#9;A&#9;animal</par>
    <par class="choice-b">&#9;B&#9;dog </par>
    <par class="choice-c">&#9;C&#9;creature</par>
    <par class="choice-d">&#9;D&#9;pet</par>
    <par class="Answer">B</par>
    <par class="g_code">G5U1S8</par>

<par class="stem_sa">&#9;3&#9;Describe the connotation of the word <inline style="font-style: italic;">mutt</inline> and explain wheeher it is positive or negative. </par> <par class="Answer"><inline style="font-style: italic;"><target id="OLE_LINK1" /><target id="OLE_LINK2" />Answers will vary. Possible answer:</inline> The word <inline style="font-style: italic;">mutt</ inline> has the negative connotation of a dog that isn’t worth very much or that isn’t good-looking.<endtarget id="OLE_LINK1" / ><endtarget id="OLE_LINK2" /></par>
    <par class="g_code">G5U1S8</par>
<--much more like this-->

</part>
</document>

My goal is the wrap each question in a question element:
<question>
<par class="stem_mc">&#9;1&#9;Read the sentence. Then choose the best synonym to replace the boldfaced word.</par> <par class="display">The threat of rain makes it <inline style="font-weight: bold;">dubious</inline> that the game will go on as scheduled.</par>
    <par class="choice-a">&#9;A&#9;doubtful</par>
    <par class="choice-b">&#9;B&#9;likely</par>
    <par class="choice-c">&#9;C&#9;hopeful</par>
    <par class="choice-d">&#9;D&#9;obvious</par>
    <par class="Answer">A</par>
    <par class="g_code">G5U1S5</par>
</question>
<question>
<par class="stem_mc">&#9;2&#9;As used in the sentence below, what is the denotation of the word <inline style="font-style: italic;">mutt?</inline></par> <par class="display">“What is that mutt doing in our yard?” asked Dad.</par>
    <par class="choice-a">&#9;A&#9;animal</par>
    <par class="choice-b">&#9;B&#9;dog </par>
    <par class="choice-c">&#9;C&#9;creature</par>
    <par class="choice-d">&#9;D&#9;pet</par>
    <par class="Answer">B</par>
    <par class="g_code">G5U1S8</par>
</question>
<question>
<par class="stem_sa">&#9;3&#9;Describe the connotation of the word <inline style="font-style: italic;">mutt</inline> and explain wheeher it is positive or negative. </par> <par class="Answer"><inline style="font-style: italic;"><target id="OLE_LINK1" /><target id="OLE_LINK2" />Answers will vary. Possible answer:</inline> The word <inline style="font-style: italic;">mutt</ inline> has the negative connotation of a dog that isn’t worth very much or that isn’t good-looking.<endtarget id="OLE_LINK1" / ><endtarget id="OLE_LINK2" /></par>
    <par class="g_code">G5U1S8</par>
</question>

Notice that each question starts with a stem attribute and is anchored with a g_code attribute. But there can be various <par> elements between. Is there an easy way to "select" all the <par> elements between two <par> elements?


Terry Ofner


--~------------------------------------------------------------------
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>
--~--