Project

Profile

Help

Quirk with indentation of result document created from xsl:merge with streamable for-each-source

Added by Martin Honnen about 7 years ago

Using @xsl:output indent="yes"@ and @xsl:strip-space elements="*"@ Saxon usually gives me a nice and consistently formatted output document, however, when using the XSLT 3.0 @xsl:merge@ together with an @xsl:merge-source for-each-source@ the output is no longer that nicely formatted, for instance the end tag of an element copied from the source ends up further indented than the start tag.

Here is a reduced (only a single source as that suffices to demonstrate the issue) test case:




	
	test201709270401.xml
	
	
	
	
	
		
			
				
					
				
				
					
				
			
		
	
	

The input document passed as @input1-uri@ is e.g.




	
		a
		1
	
	
		b
		2
	
	
		c
		3
	

Now when I run that stylesheet with Saxon 9.8.04 EE as well as HE from the command line with @-it@ the output is




   
                    a
                    1
          
   
                    c
                    3
          

As you can see, the indentation of the @@ is different from the @@ and the @foo@ and @bar@ child elements are indented rather strongly compared to the usual indentation I get from Saxon.

When I write a similar stylesheet using



instead the output is as expected:




   
      a
      1
   
   
      c
      3
   

Is there any reason in the XSLT 3 spec/serialization spec why Saxon indents the result that oddly with input coming from the @xsl:merge for-each-source@? Is there any way to get the normal indentation when using that construct?


Please register to reply