Looks like when I do xsl:for-each select="//MeetingPollingParts"
I am falling out of my data and going outside of the select="//MeetingPollingQuestion"
. Do I need to do any to only get the data from that node?
XSLT
<xsl:template match="//ArrayOfMeetingPollingQuestion">
<xsl:for-each select="//MeetingPollingQuestion">
<div class="portlet box blue sortable page-break-before: always" style="page-break-after: always;border: 1px solid #0265A6;">
<div class="portlet-title" style="background-color: #0265A6;min-height:41px">
<xsl:choose>
<xsl:when test="MeetingPollingQuestionTypeId = 2">
<div class="caption">
<i class="fa fa-th"></i>Multiple Choice
</div>
<div class="portlet-body" style="background-color: #fff;padding: 15px;">
<xsl:for-each select="//MeetingPollingParts">
<xsl:choose>
<xsl:when test="MeetingPollingPartsTypeId = 1">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<xsl:value-of select="MeetingPollingPartsValues/MeetingPollingPartsValues/QuestionValue" disable-output-escaping="yes"/
</div>
</div>
</div>
</xsl:when>
<xsl:when test="MeetingPollingPartsTypeId = 3">
<xsl:for-each select="MeetingPollingPartsValues">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="radio"></input>
<label>
<xsl:value-of select="MeetingPollingParts/MeetingPollingParts/MeetingPollingPartsValues/MeetingPollingPartsValues/QuestionValue" disable-output-escaping="yes"/>
</label>
</div>
</div>
</div>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</div>
</xsl:when>
</xsl:choose>
</div>
</div>
</xsl:for-each>
</xsl:template>
XML
<ArrayOfMeetingPollingQuestion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MeetingPollingQuestion>
<MeetingPollingQuestionId>267</MeetingPollingQuestionId>
<MeetingPollingId>36</MeetingPollingId>
<MeetingPollingQuestionTypeId>2</MeetingPollingQuestionTypeId>
<SequenceOrder>4</SequenceOrder>
<IsVisible>true</IsVisible>
<MeetingPollingParts>
<MeetingPollingParts>
<MeetingPollingPartsId>810</MeetingPollingPartsId>
<MeetingPollingPartsTypeId>1</MeetingPollingPartsTypeId>
<MeetingPollingQuestionId>267</MeetingPollingQuestionId>
<MeetingPollingPartsValues>
<MeetingPollingPartsValues>
<MeetingPollingPartsValuesId>1379</MeetingPollingPartsValuesId>
<MeetingPollingPartsId>0</MeetingPollingPartsId>
<MeetingPollingPartsValuesTypeId>1</MeetingPollingPartsValuesTypeId>
<QuestionValue><p><span style="font-size:14.0pt;font-family:'Calibri',sans-serif;">1. Should zanubrutinib/venetoclax/obinutuzumab be included as a 1L option <em>for&nbsp;all patients</em> with classical <em>TP53</em>&nbsp;mutated MCL?&nbsp;&nbsp;<strong></strong></span></p></QuestionValue>
<FileManagerId>0</FileManagerId>
</MeetingPollingPartsValues>
</MeetingPollingPartsValues>
</MeetingPollingParts>
<MeetingPollingParts>
<MeetingPollingPartsId>811</MeetingPollingPartsId>
<MeetingPollingPartsTypeId>3</MeetingPollingPartsTypeId>
<MeetingPollingQuestionId>267</MeetingPollingQuestionId>
<MeetingPollingPartsValues>
<MeetingPollingPartsValues>
<MeetingPollingPartsValuesId>1380</MeetingPollingPartsValuesId>
<MeetingPollingPartsId>0</MeetingPollingPartsId>
<MeetingPollingPartsValuesTypeId>3</MeetingPollingPartsValuesTypeId>
<QuestionValue>Yes</QuestionValue>
<FileManagerId>0</FileManagerId>
</MeetingPollingPartsValues>
<MeetingPollingPartsValues>
<MeetingPollingPartsValuesId>1381</MeetingPollingPartsValuesId>
<MeetingPollingPartsId>0</MeetingPollingPartsId>
<MeetingPollingPartsValuesTypeId>3</MeetingPollingPartsValuesTypeId>
<QuestionValueQuestionValue>No</QuestionValue>
<FileManagerId>0</FileManagerId>
</MeetingPollingPartsValues>
<MeetingPollingPartsValues>
<MeetingPollingPartsValuesId>1382</MeetingPollingPartsValuesId>
<MeetingPollingPartsId>0</MeetingPollingPartsId>
<MeetingPollingPartsValuesTypeId>3</MeetingPollingPartsValuesTypeId>
<QuestionValue>Abstain</QuestionValue>
<FileManagerId>0</FileManagerId>
</MeetingPollingPartsValues>
</MeetingPollingPartsValues>
</MeetingPollingParts>
<MeetingPollingParts>
<MeetingPollingPartsId>812</MeetingPollingPartsId>
<MeetingPollingPartsTypeId>4</MeetingPollingPartsTypeId>
<MeetingPollingQuestionId>267</MeetingPollingQuestionId>
<MeetingPollingPartsValues>
<MeetingPollingPartsValues>
<MeetingPollingPartsValuesId>1383</MeetingPollingPartsValuesId>
<MeetingPollingPartsId>0</MeetingPollingPartsId>
<MeetingPollingPartsValuesTypeId>4</MeetingPollingPartsValuesTypeId>
<QuestionValue>Is Required</QuestionValue>
<FileManagerId>0</FileManagerId>
</MeetingPollingPartsValues>
</MeetingPollingPartsValues>
</MeetingPollingParts>
</MeetingPollingParts>
</MeetingPollingQuestion>
</ArrayOfMeetingPollingQuestion>
I suggest you forget about the use of //
, it is neither needed in a match pattern nor it is needed in a select
attribute of a for-each
where you are trying to select a child element of the context node (defined by the outer template or an outer for-each
). If you have a specific need to go down from the context node to arbitrary levels of descendants use descendant::foo
or .//foo
but certainly never //foo
.