Hi,
I am trying to convert a word xml into another xml file format using XSLT.
Here I need to check the all the following siblings with some condition. If that condition is satisfied, the control should exit from that loop.

How can i achieve this, I am desperately need this.

Details:

2.PERSONNEL YES NO N/A
a. Are there sufficient maintenance personnel to safely maintain company aircraft at primary facility and en route locations?
b. Does the new-hire process provide for:
(1) Sufficient background check?
(2) Drug and alcohol abuse testing?
c. Does the carrier experience a great deal of turnover?
d. Are the carrier’s maintenance employee’s union members?
(1) When is the contract up for renegotiations and are any
problems expected?
(2) What is the quality of the relationship between management
and the union?

This the Table in a Word Document (Screen Shot here: http://wikisend.com/download/298068/Untitled.png). When i save the word doc as word xml 2003 format, it will generate the following xml file.

This is the Input XML:( I tried to minimise it ASAP, but it is auto generated)

<w:tbl>
<w:tr wsp:rsidR="00E77079" wsp:rsidRPr="00E7149E" wsp:rsidTr="00B51904">
<w:tc>
<w:tcPr>
<w:tcW w:w="3852" w:type="pct"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00E77079" wsp:rsidRPr="00221D14" wsp:rsidRDefault="00E77079" wsp:rsidP="00040FAA">
<w:pPr>
<w:tabs>
<w:tab w:val="left" w:pos="360"/>
<w:tab w:val="left" w:pos="720"/>
<w:tab w:val="left" w:pos="1080"/>
</w:tabs>
<w:rPr>
<w:b/>
<w:color w:val="000000"/>
</w:rPr>
</w:pPr>
<w:r wsp:rsidRPr="00221D14">
<w:rPr>
<w:color w:val="000000"/>
</w:rPr>
<w:br w:type="column"/>
</w:r>
<w:r>
<w:rPr>
<w:b/>
<w:b-cs/>
<w:color w:val="0000A0"/>
</w:rPr>
<w:t>2.</w:t>
</w:r>
<w:r wsp:rsidRPr="00221D14">
<w:rPr>
<w:b/>
<w:b-cs/>
<w:color w:val="0000A0"/>
</w:rPr>
<w:t>PERSONNEL</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="384" w:type="pct"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00E77079" wsp:rsidRPr="00221D14" wsp:rsidRDefault="00E77079" wsp:rsidP="00040FAA">
<w:pPr>
<w:tabs>
<w:tab w:val="left" w:pos="360"/>
<w:tab w:val="left" w:pos="720"/>
<w:tab w:val="left" w:pos="1080"/>
</w:tabs>
<w:spacing w:before="100" w:before-autospacing="on" w:after="100" w:after-autospacing="on"/>
<w:jc w:val="center"/>
<w:rPr>
<w:color w:val="000000"/>
</w:rPr>
</w:pPr>
<w:r wsp:rsidRPr="00221D14">
<w:rPr>
<w:b-cs/>
<w:color w:val="0000A0"/>
</w:rPr>
<w:t>YES</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="384" w:type="pct"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00E77079" wsp:rsidRPr="00221D14" wsp:rsidRDefault="00E77079" wsp:rsidP="00040FAA">
<w:pPr>
<w:tabs>
<w:tab w:val="left" w:pos="360"/>
<w:tab w:val="left" w:pos="720"/>
<w:tab w:val="left" w:pos="1080"/>
</w:tabs>
<w:spacing w:before="100" w:before-autospacing="on" w:after="100" w:after-autospacing="on"/>
<w:jc w:val="center"/>
<w:rPr>
<w:color w:val="000000"/>
</w:rPr>
</w:pPr>
<w:r wsp:rsidRPr="00221D14">
<w:rPr>
<w:b-cs/>
<w:color w:val="0000A0"/>
</w:rPr>
<w:t>NO</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="381" w:type="pct"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00E77079" wsp:rsidRPr="00221D14" wsp:rsidRDefault="00E77079" wsp:rsidP="00040FAA">
<w:pPr>
<w:tabs>
<w:tab w:val="left" w:pos="360"/>
<w:tab w:val="left" w:pos="720"/>
<w:tab w:val="left" w:pos="1080"/>
</w:tabs>
<w:spacing w:before="100" w:before-autospacing="on" w:after="100" w:after-autospacing="on"/>
<w:jc w:val="center"/>
<w:rPr>
<w:color w:val="000000"/>
</w:rPr>
</w:pPr>
<w:r wsp:rsidRPr="00221D14">
<w:rPr>
<w:b-cs/>
<w:color w:val="0000A0"/>
</w:rPr>
<w:t>N/A</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr><w:tr>
.....Similar Rows...
</w:tbl>


XSLT:


<xsl:for-each select="ns1:tr">
<xsl:element name="Question">

<xsl:variable name="Questionrow">
<xsl:for-each select="ns1:tc/ns1:p/ns1:r">
<xsl:value-of select="ns1:t"/>
</xsl:for-each>
</xsl:variable>

<xsl:attribute name="label">
<xsl:value-of select="substring(normalize-space($Questionrow),1,1)"/>
</xsl:attribute>

<xsl:attribute name="displayorder">
<xsl:value-of select="position() - 2"/>
</xsl:attribute>

<xsl:attribute name="questiontype">
<xsl:text>DoDQuestion</xsl:text>
</xsl:attribute>

<xsl:element name="Text">
<xsl:variable name="length" select="string-length(substring-before(normalize-space($Questionrow),'?'))"/>
<xsl:value-of select="substring(normalize-space($Questionrow),3,($length))"/>
</xsl:element>

<xsl:element name="Subquestions">

<xsl:for-each select="following-sibling::*">
<![CDATA[Trying to do the same as above. But How to Exit this loop when next Question Comes.]]>
</xsl:for-each>
</xsl:element>
</xsl:element>

</xsl:for-each>


Required XML Format:

<Section label="2" title="OPERATIONS MANAGEMENT (Senior Ops Manager)" displayorder="1">
<Questions>
<Question label="a" displayorder="1" questiontype="DoDQuestion">
<Text>How would you assess your relationship with the FAA?</Text>
<AnswerChoices>
<AnswerChoice code="" label="" displayorder="0" type="text" />
</AnswerChoices>
</Question>
<Question label="b" displayorder="0" questiontype="DoDQuestion">
<Text>How does operations management emphasize safety as a top priority?</Text>
<AnswerChoices>
<AnswerChoice code="" label="" displayorder="0" type="text" />
</AnswerChoices>
<Subquestions>
<Subquestion label="1" level="1" displayorder="0" questiontype="DoDQuestion">
<Text>Is your safety philosophy published and accessible to line crewmembers?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
<Subquestion label="2" level="1" displayorder="1" questiontype="DoDQuestion">
<Text>Do you interact regularly with the company’s safety focal point?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
</Subquestions>
</Question>
<Question label="c" displayorder="2" questiontype="DoDQuestion">
<Text>Does your company operate into FAA or DOD designated special airfields?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Question>
<Question label="d" displayorder="3" questiontype="DoDQuestion">
<Text>Does your company operate any missions it considers higher risk than standard?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
<Subquestions>
<Subquestion label="•" level="1" displayorder="0" questiontype="DoDQuestion">
<Text>Have these been identified in operations manuals?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
<Subquestion label="•" level="1" displayorder="1" questiontype="DoDQuestion">
<Text>Is there oversight of scheduling for theses increased risk flights?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
</Subquestions>
</Question>
</Questions>
</Section>

Seems u have exited the for-each loop in your XSL??

<xsl:for-each>

</xsl:for-each>

----

<xsl:for-each select="*" />

No I didn't, in the for each loop, if have to check one condition. If it is satisfied then the control should exit from the for-each loop.

Hi,

Yes, Instead making use of for-each , we can go for
<xsl:for-each select="following-sibling::node()">

<xsl:choose>

<xsl:when test="following-sibling::node()">

</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

I dunno how far this will work.jus give a try ..

Thanks for the quick reply...

Here i have to check all the following siblings in the table, to add the subquestions inside the Question to which they belongs.

So i have to go for for-each.

you think as a programming language
is an xsl template which can then generate a parser says that if man is valid to a node


for testing

<w:body>
		<w:tbl>
			<w:tblPr>
				<w:tblW w:w="0" w:type="auto"/>
				<w:tblBorders>
					<w:top w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
					<w:left w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
					<w:bottom w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
					<w:right w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
					<w:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
					<w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
				</w:tblBorders>
				<w:tblLook w:val="04A0"/>
			</w:tblPr>
			<w:tblGrid>
				<w:gridCol w:w="2303"/>
				<w:gridCol w:w="2303"/>
				<w:gridCol w:w="2303"/>
				<w:gridCol w:w="2303"/>
			</w:tblGrid>
			<w:tr wsp:rsidR="00C37F8D" wsp:rsidRPr="000C1858" wsp:rsidTr="000C1858">
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:proofErr w:type="spellStart"/>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>person</w:t>
						</w:r>
						<w:proofErr w:type="spellEnd"/>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:proofErr w:type="spellStart"/>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>yes</w:t>
						</w:r>
						<w:proofErr w:type="spellEnd"/>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:proofErr w:type="spellStart"/>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>no</w:t>
						</w:r>
						<w:proofErr w:type="spellEnd"/>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>n/a</w:t>
						</w:r>
					</w:p>
				</w:tc>
			</w:tr>
			<w:tr wsp:rsidR="00C37F8D" wsp:rsidRPr="000C1858" wsp:rsidTr="000C1858">
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>Question1</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>Y2</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>N2</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>X2</w:t>
						</w:r>
					</w:p>
				</w:tc>
			</w:tr>
			<w:tr wsp:rsidR="00C37F8D" wsp:rsidRPr="000C1858" wsp:rsidTr="000C1858">
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>Question2</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>Y3</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>N3</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>X3</w:t>
						</w:r>
					</w:p>
				</w:tc>
			</w:tr>
			<w:tr wsp:rsidR="00C37F8D" wsp:rsidRPr="000C1858" wsp:rsidTr="000C1858">
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="00C95B22" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r wsp:rsidRPr="000C1858">
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>Question3</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>Y4</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>N4</w:t>
						</w:r>
					</w:p>
				</w:tc>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="2303" w:type="dxa"/>
					</w:tcPr>
					<w:p wsp:rsidR="00C95B22" wsp:rsidRPr="000C1858" wsp:rsidRDefault="009D616C" wsp:rsidP="000C1858">
						<w:pPr>
							<w:spacing w:after="0" w:line="240" w:line-rule="auto"/>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:fareast="Calibri" w:h-ansi="Calibri" w:cs="Times New Roman"/>
							</w:rPr>
							<w:t>X4</w:t>
						</w:r>
					</w:p>
				</w:tc>
			</w:tr>
		</w:tbl>
		<w:p wsp:rsidR="004F4CAC" wsp:rsidRDefault="009D616C"/>
		<w:sectPr wsp:rsidR="004F4CAC" wsp:rsidSect="003066C7">
			<w:pgSz w:w="11906" w:h="16838"/>
			<w:pgMar w:top="1417" w:right="1417" w:bottom="1134" w:left="1417" w:header="708" w:footer="708" w:gutter="0"/>
			<w:cols w:space="708"/>
			<w:docGrid w:line-pitch="360"/>
		</w:sectPr>
	</w:body>

xsl only the most important
use predicates as if structural

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
	<xsl:output indent="yes" method="xml"/>
	<xsl:template match="/">
		<Questions>
			<xsl:apply-templates select="w:wordDocument/w:body"/>
		</Questions>
	</xsl:template>
	<xsl:template match="w:body">
		<xsl:apply-templates select="w:tbl"/>
	</xsl:template>
	<xsl:template match="w:tbl">
		<xsl:apply-templates select="w:tr[position() &gt; 1]"/>
	</xsl:template>
	<xsl:template match="w:tr">
		<xsl:apply-templates select="w:tc[ 1]" mode="text"/>
		<AnswerChoices>
		<xsl:apply-templates select="w:tc[position() &gt; 1]" mode="ansert"/>
		</AnswerChoices>
	</xsl:template>
	<xsl:template match="w:tc" mode="text">
		<Text>
			<xsl:value-of select="w:p/w:r/w:t"/>
		</Text>
	</xsl:template>
	<xsl:template match="w:tc" mode="ansert">		
			<xsl:apply-templates select="w:p/w:r/w:t">
			<xsl:with-param name="pos" select="position()"/>
			</xsl:apply-templates>		
	</xsl:template>
	
	<xsl:template match="w:t">
	<xsl:param name="pos"/>
		<xsl:choose>
			<xsl:when test="$pos = 1">
				<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio"/>
			</xsl:when>
			<xsl:when test="$pos = 2">
				<AnswerChoice code="NO" label="No" displayorder="0" type="radio"/>
			</xsl:when>
			<xsl:when test="$pos = 3">
				<AnswerChoice code="N/A" label="N/A" displayorder="0" type="radio"/>
			</xsl:when>			
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

result

<?xml version='1.0' ?>
<Questions xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
  <Text>Question1</Text>
  <AnswerChoices>
    <AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio"/>
    <AnswerChoice code="NO" label="No" displayorder="0" type="radio"/>
    <AnswerChoice code="N/A" label="N/A" displayorder="0" type="radio"/>
  </AnswerChoices>
  <Text>Question2</Text>
  <AnswerChoices>
    <AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio"/>
    <AnswerChoice code="NO" label="No" displayorder="0" type="radio"/>
    <AnswerChoice code="N/A" label="N/A" displayorder="0" type="radio"/>
  </AnswerChoices>
  <Text>Question3</Text>
  <AnswerChoices>
    <AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio"/>
    <AnswerChoice code="NO" label="No" displayorder="0" type="radio"/>
    <AnswerChoice code="N/A" label="N/A" displayorder="0" type="radio"/>
  </AnswerChoices>
</Questions>

Really thanks for your valuable reply....

But My problem is how to put the subquestions inside the Corresponding question. See this screen shot .

Here Rows starting with alphabets(like a. , b. , c. ) are Questions. And rows starting with ( like (1) , (2) ..) are subquestion for the above row.

Example : Here (1) and (2) rows are the subquestions of Question "a.".


I am able to handle upto the Questions level. But how can i put the subquestions inside the Question node by looping all the following-siblings of the Current. Because the current row may have any number of subquestions.

<Section label="2" title="OPERATIONS MANAGEMENT (Senior Ops Manager)" displayorder="1">
<Questions>
<Question label="a" displayorder="1" questiontype="DoDQuestion">
<Text>How would you assess your relationship with the FAA?</Text>
<AnswerChoices>
<AnswerChoice code="" label="" displayorder="0" type="text" />
</AnswerChoices>
</Question>
<Question label="b" displayorder="0" questiontype="DoDQuestion">
<Text>How does operations management emphasize safety as a top priority?</Text>
<AnswerChoices>
<AnswerChoice code="" label="" displayorder="0" type="text" />
</AnswerChoices>
[B]<Subquestions>
<Subquestion label="1" level="1" displayorder="0" questiontype="DoDQuestion">
<Text>Is your safety philosophy published and accessible to line crewmembers?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
<Subquestion label="2" level="1" displayorder="1" questiontype="DoDQuestion">
<Text>Do you interact regularly with the company’s safety focal point?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
</Subquestions>[/B]
</Question>
<Question label="c" displayorder="2" questiontype="DoDQuestion">
<Text>Does your company operate into FAA or DOD designated special airfields?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Question>
<Question label="d" displayorder="3" questiontype="DoDQuestion">
<Text>Does your company operate any missions it considers higher risk than standard?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
<Subquestions>
<Subquestion label="•" level="1" displayorder="0" questiontype="DoDQuestion">
<Text>Have these been identified in operations manuals?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
<Subquestion label="•" level="1" displayorder="1" questiontype="DoDQuestion">
<Text>Is there oversight of scheduling for theses increased risk flights?</Text>
<AnswerChoices>
<AnswerChoice code="Yes" label="Yes" displayorder="0" type="radio" />
<AnswerChoice code="No" label="No" displayorder="1" type="radio" />
<AnswerChoice code="NA" label="N/A" displayorder="2" type="radio" />
</AnswerChoices>
</Subquestion>
</Subquestions>
</Question>
</Questions>
</Section>

that is the distinctive mark in the parenthesis under question

Can you explain little bit..I can't get you.

Thanks in Advance...

I live in German

so my English is not so good
I translate with google

I want to be a sign of recognition for the subquestion

i guess the parentheses

person yes no n / a
Question1 N2 Y2 X2
(1) Question1.1 A1 N11 X12
(2) Question1.2 A2 N12 X12
Question2 Y3 X3 N3
(3) Question1.3 A3 N21 Q
(4) Question1.4 A4 N22 Q
Question3 Y4 N4 X4

Yes U r correct..parentheses is for the subquestion. I not able to get your logic here. I am beginner in xslt. Can you explain the logic. What u mentioned above.

Really Thanks for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.