Project

Profile

Help

Maintenance: Planio will be observing a scheduled maintenance window this Sunday, November 10, 2024 from 20:00 UTC until 21:00 UTC to perform important network maintenance in our primary data center. Your Planio account will be unavailable for a few minutes during this maintenance window.

RE: Problem applying XSL xsl:copy-of when sub node has at... » xsl.xsl

Anne FAVEUR, 2018-12-19 14:39

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xft="http://www.exchangefortravel.org/xft/current"
xmlns:dx="http://www.afidium.com/dx"
xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude"
exclude-result-prefixes="xs xft dx h xi"
version="2.0">
<xsl:template match="xft:Actions">
<xsl:variable name="xft:SegmentNodes">
<Segments>
<xsl:sequence select="descendant::xft:Segment"/>
</Segments>
</xsl:variable>
<Transaction Status="Success" TimeStamp="2018-12-16T18:53:13+01:00"
xmlns="http://www.exchangefortravel.org/xft/current"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TransactionResponseType">
<xsl:copy-of select="xft:Action[1]/xft:Transaction/xft:Control"/>
<xsl:copy-of select="xft:Action[1]/xft:Transaction/xft:Action"/>
<!-- This works, though children have @xsi:type -->
<Bookings>
<xsl:copy-of select="xft:Action/xft:Transaction/xft:Booking"/>
</Bookings>
<!-- this works because first node is segments without @xsi:type -->
<xsl:copy-of select="$xft:SegmentNodes"/>
<!-- this fails because some first elements have @xsi:type -->
<Segments>
<xsl:copy-of select="descendant::xft:Segment"/>
</Segments>
</Transaction>
</xsl:template>
</xsl:stylesheet>
(3-3/3)