Hallo everyone,
My OUTPUT XML should look like this:
Code:
<ContextInstance id="00001">
<Person id="1">
<Name>Sandra Jones</Name>
<Seks>Female</Seks>
</Person>
<Address id="2" refid="1">
<Street>My Street</Street>
<Country>USA</Country>
</Address>
</ContextInstance>
I have been trying to create the xsl, which can reference the Attribute "refid" in the element "Addresse". Unfortunately I was not successfull. This is my actual xsl:
Code:
<xsl:template name="random_id">
<xsl:value-of select="format-number(round(9999 * java:nextDouble($random)), '0000')" />
</xsl:template>
<ContextInstance><xsl:attribute name="id"><xsl:call-template name="random_id" /></xsl:attribute>
<Person><xsl:attribute name="id"><xsl:call-template name="random_id" /></xsl:attribute>
<Name>my XPath Expression</Name>
<Seks>my XPath Expression</Seks>
</Person>
<Address><xsl:attribute name="id"><xsl:call-template name="random_id" /></xsl:attribute>
<xsl:attribute name="refNB"></xsl:attribute>
<Street>my XPath Expression</Street>
<Country>my XPath Expression</Country>
</Address>
</ContextInstance>
As you can see, I am facing the Problem to get the value of refid on the fly. The Attribute refid of the element Address references the Person id Attribute.
Does anybody have any idea how I can put copy the value from the Person id Attribute into the refid of the addresse?
Thank you very much.
Regards,
Ratna
