Project

Profile

Help

xsl:stream with grouned nodes created with snapshot(/root/items/foo) fails streamability analysis in Saxon but work with Exselt

Added by Martin Honnen almost 8 years ago

Over on Stackoverflow there is a question on splitting up a document using XSLT 2.0, while testing whether this task could be solved as well in XSLT 3.0 in a streaming way I created a stylesheet using @xsl:copy-of select="/"@ on grounded nodes processed using @xsl:for-each select="snapshot(class/students/student)"@ and Saxon 9.7 and 9.6 reject that as not being streamable because "Expression (/) is free-ranging". Exselt on the other hand assesses it as streamable and gives me the wanted result.

Here is the complete stylesheet:




	
	
	
	
		
			
				
			
		
	
	

Shouldn't this be streamable considering that the @for-each@ clearly processes grounded nodes?

A sample input document is




	
		A
		jscvjab
		zcm,ab
		
			1
			m9
			
				25
				science
				popeye
				
					true
				
				
					
						
							kullu
							nSVCm
							zmbvc
						
					
				
			
		
		
			2
			m5
			
				92
				commerce
				brutus
				
					
						m9
						<title xfa:contentType="text/html">
							Title
						</title>
						
							Contents
						
						Slide
					
					
						m95
						<title xfa:contentType="text/html">
							SubTitle
						</title>
						
							Jerry
						
						SubTitle
					
					false
				
				
					
						
							zxZXVj
							kjsdgfjkvnwsa
							kadbvscjkna
						
					
				
			
		
	
	
		B
		jzvxcbhjnba
		mjZSVxcj
		
			3
			m8
			
				91
				humanities
				hercules
				
					
						m954
						<title xfa:contentType="text/html">
							Title
						</title>
						
							Current
						
						Title
					
					
						m9542
						<title xfa:contentType="text/html">
							SubTitle
						</title>
						
							Sr
						
						SubTitle
					
					false
				
				
					
						
							aksbgdk
							zsdbZXSBGCDSNXCJK
							slzdhfksjfml
						
					
				
			
		
		
			3
			m8
			
				91
				humanities
				aladin
				
					
						m954
						<title xfa:contentType="text/html">
							Title
						</title>
						
							Current
						
						Title
					
					
						m9542
						<title xfa:contentType="text/html">
							SubTitle
						</title>
						
							Sr
						
						SubTitle
					
					false
				
				
					
						
							aksbgdk
							zsdbZXSBGCDSNXCJK
							slzdhfksjfml
						
					
				
			
		
		
			3
			m8
			
				91
				humanities
				aladin
				
					
						m954
						<title xfa:contentType="text/html">
							Title
						</title>
						
							Current
						
						Title
					
					
						m9542
						<title xfa:contentType="text/html">
							SubTitle
						</title>
						
							Sr
						
						SubTitle
					
					false
				
				
					
						
							aksbgdk
							zsdbZXSBGCDSNXCJK
							slzdhfksjfml
						
					
				
			
		
		
			4
			m3
			
				75
				PCM
				hercules
				
					
						j4423
						<title xfa:contentType="text/html">
							Title
						</title>
						
							dfzxsdbjchA
						
						zdbgcfjkbna
					
					
						m95
						<title xfa:contentType="text/html">
							zdjbhfjkcda
						</title>
						
							sdjkhzjk
						
						mzsdjkbjk
					
					true
				
				
					
						
							sdbnfn
							masdjkljk
							msjkldbhfjkn
						
					
				
			
		
	
	
		
			Output
			Font
			10pt
		
		
			Out
			Text
			127,127,127
		
		
			put
			Slide
			18pt
		
		
			utp
			Slide
			127
		
	
	
	
		zcdfjkaqbkd
	    

To solve that problem in Saxon using streaming I pushed the snapshots to a non-streaming mode:




	
	
	
	
		
	
	
	
		
			
		
	
	

But I keep wondering whether the initial attempt should not be assessed streamable.


Replies (4)

Please register to reply

RE: xsl:stream with grounded nodes created with snapshot(/root/items/foo) fails streamability analysis in Saxon but works with Exselt - Added by Martin Honnen almost 8 years ago

When I use a slightly different expression in the @copy-of@ which nevertheless copies ancestors of the grounded nodes created with @snapshot@, as in @<xsl:copy-of select="ancestor::class"/>@, then Saxon accepts the code and processes it in a streaming mode successfully:




	
	
	
	
		
			
				
			
		
	
	

RE: xsl:stream with grounded nodes created with snapshot(/root/items/foo) fails streamability analysis in Saxon but works with Exselt - Added by Martin Honnen almost 8 years ago

Even @<xsl:copy-of select="root()"/>@ works so I guess I need to check whether @/@ and @root()@ for nodes created by @snapshot()@ mean something different.

RE: xsl:stream with grouned nodes created with snapshot(/root/items/foo) fails streamability analysis in Saxon but work with Exselt - Added by Michael Kay almost 8 years ago

Saxon's streamability analysis for the expression "/" is missing a case for where the context posture is grounded. I think the analysis in the spec is correct, but Saxon is taking a short-cut.

I've added this as W3C test case si-for-each-807.

    (1-4/4)

    Please register to reply