I have an xml that uses an IDREFS field. I need to extract those id to put their in their own element.
Here's the basic structure I think I need but I don't know what to use in the select functions.
<xsl:template match="node_With_IDREFS_field">
<xsl:for-each select="EACH ID IN @idrefsField">
<xsl:element name="newElement">
<xsl:attribute name="ref"><xsl:value-of select="THE IDREF"/></xsl:attribute>
</xsl:element>
</xsl:for-each>
<!-- keep rest of content -->
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
So the from this node
<node_With_IDREFS_field idrefsField="id1 id2"/>
The result would be
<node_With_IDREFS_field>
<newElement ref="id1"/>
<newElement ref="id2"/>
</node_With_IDREFS_field>
Thanks for your help.
See Question&Answers more detail:os