I have multiple elements that contain an uniqueId(generated and stored in a variable). I have recursively added the element(object class=Bundle with unique id ) with the xsl as follows
<xsl:template match="visualChildren">
<object class="Set" >
<installChildren>
<xsl:call-template name="Bundle">
<xsl:with-param name="i" select="1"/>
<xsl:with-param name="limit" select="4" />
</xsl:call-template>
</installChildren>
</object>
</xsl:template>
<xsl:template name="Bundle">
<xsl:param name="i"/>
<xsl:param name="limit"/>
<xsl:variable name="BundleObjId">
<xsl:value-of select="php:function('GenerateObjId')"/>
</xsl:variable>
<xsl:if test="$i <= $limit">
<object class="Bundle" objectID="{$BundleObjId}">
<property></property>
</object>
</xsl:if>
<xsl:call-template name="Bundle">
<xsl:with-param name="i" select="$i+1"/>
<xsl:with-param name="limit" select="$limit" />
</xsl:call-template>
</xsl:template>
This produces the following result
<visualChildren>
<object class="Set" >
<installChildren>
<object class="Bundle" objectID="33110emc908m">
<property></property>
</object>
<object class="Bundle" objectID="43110emc9667m">
<property></property>
</object>
</installChildren>
</object>
</visualChildren>
Now I need to populate the BundleObjId as the parent's sibling so that it gets referenced.
Required output is:
<visualChildren>
<object class="Set" >
<installChildren>
<object class="Bundle" objectID="33110emc908m">
<property></property>
</object>
<object class="Bundle" objectID="43110emc9667m">
<property></property>
</object>
</installChildren>
</object>
<object RefId=33110emc908m />
<object RefId=43110emc9667m />
</visualChildren>
Please help me achieve this with xslt 1.0 by adding to the existing xsl.
It's difficult to provide an answer without seeing the input. I believe you need to do something like the following:
XSLT 1.0
Given an artificial input of:
the result will be something like: