|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Using sibling value in streaming mode
Am 31.08.2019 um 10:25 schrieb Michael Kay mike@xxxxxxxxxxxx:
If you want to achieve some level of streaming within the map, then
clearly it's not going to be perfect streaming; in the worst case, if
the "id" comes last, then you're going to have to buffer something in
memory. Burst-mode streaming buffers the input in memory; an
alternative is to buffer the output, which you can achieve using xsl:fork:
<xsl:template match="map" mode="streamed">
B B <xsl:fork>
B B B <xsl:sequence>
B B B B <id>{string[@key='id']}</id>
B B B <xsl:sequence>
B B B <xsl:sequence>
B B B B <xsl:apply-templates select="string[not(@key='id')]"
mode="streamed"/>
B B B <xsl:sequence>
B B </xsl:fork>
</xsl:template>
Does xsl:fork as outlined above really help for the below wanted output
where you need the "id" to construct the "item" for each of the
string[not(@key='id')] elements?
Required output:
<items>
B B B <item>
B B B B B B <id>123456789</id>
B B B B B B <key>key1<key>
B B B B B B <val>value1</val>
B B B </item>
B B B ...
B B B <item>
B B B B B B <id>123456789</id>
B B B B B B <key>id<key>
B B B B B B <val>123456789</val>
B B B </item>
B B B ...
B B B <item>
B B B B B B <id>123456789</id>
B B B B B B <key>keyN<key>
B B B B B B <val>valueN</val>
B B B </item>
B B B ...
</items>
The value of <string key="id"> is used as <id> in <item> elements. The
problem is that <string key="id"> can occur in any position in the
<map>.

|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|