srtwentyde
Technical User
I am a newbie, and I just looked at the FAQ and search turned up too many irrelevant things. I want to display the value of name in data item when I'm matching another element:
<TABLE name="table1">
<ITEM id="105" name="col1"/>
<ITEM id="106" name="col2"/>
<IDX NAME="IDX1">
<D_ID col_id="105"/>
<D_ID col_id="106"/>
</IDX>
</TABLE>
I want to print plaintext output in SQL so it looks like:
CREATE UNIQUE INDEX IDX1 on table1 (col1, col2);
My XSL is something like:
<xsl:template-match select="IDX">
CREATE UNIQUE INDEX <xsl:value-of select="@NAME"/> on <xsl:value-of select="TABLE[@name]"/> (<xsl:apply-templates select="D_ID"/>
</xsl:template>
<xsl:template-match select="D_ID">
<xsl:value-of select="col_id"/>);
</xsl:template>
This last template can only print 105, 106); so my output looks like: CREATE UNIQUE INDEX IDX1 on table1 (105, 106);
while I was really looking to print:
CREATE UNIQUE INDEX IDX1 on table1 (col1, col2);
How do I print the 'name' in ITEM rather than the 'col_id' in the "D_ID" template?
Thanks for your time.
srtwentyde
<TABLE name="table1">
<ITEM id="105" name="col1"/>
<ITEM id="106" name="col2"/>
<IDX NAME="IDX1">
<D_ID col_id="105"/>
<D_ID col_id="106"/>
</IDX>
</TABLE>
I want to print plaintext output in SQL so it looks like:
CREATE UNIQUE INDEX IDX1 on table1 (col1, col2);
My XSL is something like:
<xsl:template-match select="IDX">
CREATE UNIQUE INDEX <xsl:value-of select="@NAME"/> on <xsl:value-of select="TABLE[@name]"/> (<xsl:apply-templates select="D_ID"/>
</xsl:template>
<xsl:template-match select="D_ID">
<xsl:value-of select="col_id"/>);
</xsl:template>
This last template can only print 105, 106); so my output looks like: CREATE UNIQUE INDEX IDX1 on table1 (105, 106);
while I was really looking to print:
CREATE UNIQUE INDEX IDX1 on table1 (col1, col2);
How do I print the 'name' in ITEM rather than the 'col_id' in the "D_ID" template?
Thanks for your time.
srtwentyde