XSLT descendant axis problem
Here should go questions about transforming XML with XSLT and FOP.
			- 
				sarcanon
 - Posts: 45
 - Joined: Mon Aug 24, 2009 11:42 pm
 
XSLT descendant axis problem
I have been beating my head against the wall with an XSLT issue for a couple of hours, and I clearly am lost.
I am trying to transform some XML to HTML. The relevant portion of my source XML looks like this:
And I have an XSL version 2.0 stylesheet that contains this template:
When this template matches the second <p> tag in my XML, I am expecting the variable $sectTop to be false, but it is in fact True. This is contrary to my (limited) understanding of how XPath expressions work. Since the <p> tag in question is the second descendant of its div ancestor, and not the first, the boolean expression should evaluate as False.
Can someone kindly enlighten me as to why I am getting this unexpected result?
I am sure this problem is a result of my ignorance, but for what it is worth, I am using Oxygen XML 11 (build 2009100911) and Saxon-PE 9.2.0.2 as my transformer.
Many thanks in advance.
			
			
									
									
						I am trying to transform some XML to HTML. The relevant portion of my source XML looks like this:
Code: Select all
  <div xml:id="sect107" type="section" n="107">
    <head>F. Indefinite Pronouns.</head>
    <p/>
    <div xml:id="sect107.1" type="subsection" n="1">
      <p/>
      [...]
    </div>
  </div>
Code: Select all
  <!-- match first <p> within <div> -->
  <xsl:template match="tei:div/tei:p[not(preceding-sibling::tei:p)]">
    <xsl:for-each select=".">
       <xsl:variable name="sectTop" select="ancestor::tei:div[@type='section'][1]/descendant::tei:p[1]=current()"/>
       [...]
    </xsl:for-each>
  </xsl:template>
Can someone kindly enlighten me as to why I am getting this unexpected result?
I am sure this problem is a result of my ignorance, but for what it is worth, I am using Oxygen XML 11 (build 2009100911) and Saxon-PE 9.2.0.2 as my transformer.
Many thanks in advance.
- 
				sarcanon
 - Posts: 45
 - Joined: Mon Aug 24, 2009 11:42 pm
 
Re: XSLT descendant axis problem
In case anyone is interested, it was kindly pointed out to me in another forum that I was using the wrong comparison operator.
I should have been using "is" rather than "=", since I was intending to compare nodes and not element values.
			
			
									
									
						I should have been using "is" rather than "=", since I was intending to compare nodes and not element values.
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ SDK-API, Frameworks - Document Types
 - ↳ DocBook
 - ↳ TEI
 - ↳ XHTML
 - ↳ Other Issues
 - Oxygen XML Web Author
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Content Fusion
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen JSON Editor
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen PDF Chemistry
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Feedback
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen XML WebHelp
 - ↳ Feature Request
 - ↳ Common Problems
 - XML
 - ↳ General XML Questions
 - ↳ XSLT and FOP
 - ↳ XML Schemas
 - ↳ XQuery
 - NVDL
 - ↳ General NVDL Issues
 - ↳ oNVDL Related Issues
 - XML Services Market
 - ↳ Offer a Service