anyone know of a way to turn something like
---------------------------------------
<runcard>
<workcenter id="1" name="asdf">
<operation_list layout="3">
<operation name="a" type="b" val="c" tol="d"/>
<operation name="b" type="b" val="c" tol="d"/>
</operation>
<operation_list layout="2">
<operation name="c" type="b" val="c" tol="d"/>
<operation name="d" type="b" val="c" tol="d"/>
</operation>
</workcenter>
<workcenter id="2" name="efgh">
<operation_list layout=5">
<operation name="a" type="b" val="c" tol="d"/>
<operation name="c" type="b" val="c" tol="d"/>
</operation>
<operation_list layout="3">
<operation name="a" type="b" val="c" tol="d"/>
<operation name="d" type="b" val="c" tol="d"/>
</operation>
</workcenter>
</runcard>
----------------------------------------
into something like
----------------------------------------
<runcard_2>
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="3" name="a" type="b" ... />
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="3" name="b" type="b" ... />
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="2" name="c" type="b" ... />
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="2" name="d" type="b" ... />
<operation workcenter_id="2" workcenter_name="efgh" operation_list_layout="5" name="a" type="b" ... />
...
</runcard_2>
----------------------------------------------
i would like to do this without using a <xsl:attribute/> tag for each attribute in an <operation/> .
i have got something (which seems too simple) that will copy all of the attributes from either /runcard/workcenter/operation_list/operation, /runcard/workcenter/operation_list, or /runcard/workcenter into a new operation, but not all at the same time...here's my xsl for clarity
-----------------------------------------------------
<xsl:template match="/runcard">
<runcard_2>
<xsl:for-each select="workcenter/operation_list/operation" >
<xsl:copy>
<xsl:apply-templates select="/runcard/workcenter/@*" /> <!--copy all attributes from the workcenter to the new <runcard_2>....this works fine, other than i can't prefix the attributes, but that could be solved by prefixing them in the initial <runcard><workcenter prefix_attribute="">-->
<xsl:apply-templates select="/runcard/workcenter/operation_list/@*" /> <!--this doesn't run unless i put it above the first one, but then the first one doesn't run-->
<xsl:apply-templates select="/runcard/workcenter/operation_list/operation/@*" /> <!--same with this one...doesn't run unless called first-->
</xsl:copy>
</xsl:for-each>
</runcard_2>
</xsl:template>
<xsl:template match="runcard/workcenter/operation_list/operation/@*">
<xsl:copy/>
</xsl:template>
<xsl:template match="/runcard/workcenter/operation_list/@*">
<xsl:copy/>
</xsl:template>
<xsl:template match="/runcard/workcenter/@*">
<xsl:copy/>
</xsl:template>
--------------------------------------------
thanks for any and all help
mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
---------------------------------------
<runcard>
<workcenter id="1" name="asdf">
<operation_list layout="3">
<operation name="a" type="b" val="c" tol="d"/>
<operation name="b" type="b" val="c" tol="d"/>
</operation>
<operation_list layout="2">
<operation name="c" type="b" val="c" tol="d"/>
<operation name="d" type="b" val="c" tol="d"/>
</operation>
</workcenter>
<workcenter id="2" name="efgh">
<operation_list layout=5">
<operation name="a" type="b" val="c" tol="d"/>
<operation name="c" type="b" val="c" tol="d"/>
</operation>
<operation_list layout="3">
<operation name="a" type="b" val="c" tol="d"/>
<operation name="d" type="b" val="c" tol="d"/>
</operation>
</workcenter>
</runcard>
----------------------------------------
into something like
----------------------------------------
<runcard_2>
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="3" name="a" type="b" ... />
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="3" name="b" type="b" ... />
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="2" name="c" type="b" ... />
<operation workcenter_id="1" workcenter_name="asdf" operation_list_layout="2" name="d" type="b" ... />
<operation workcenter_id="2" workcenter_name="efgh" operation_list_layout="5" name="a" type="b" ... />
...
</runcard_2>
----------------------------------------------
i would like to do this without using a <xsl:attribute/> tag for each attribute in an <operation/> .
i have got something (which seems too simple) that will copy all of the attributes from either /runcard/workcenter/operation_list/operation, /runcard/workcenter/operation_list, or /runcard/workcenter into a new operation, but not all at the same time...here's my xsl for clarity
-----------------------------------------------------
<xsl:template match="/runcard">
<runcard_2>
<xsl:for-each select="workcenter/operation_list/operation" >
<xsl:copy>
<xsl:apply-templates select="/runcard/workcenter/@*" /> <!--copy all attributes from the workcenter to the new <runcard_2>....this works fine, other than i can't prefix the attributes, but that could be solved by prefixing them in the initial <runcard><workcenter prefix_attribute="">-->
<xsl:apply-templates select="/runcard/workcenter/operation_list/@*" /> <!--this doesn't run unless i put it above the first one, but then the first one doesn't run-->
<xsl:apply-templates select="/runcard/workcenter/operation_list/operation/@*" /> <!--same with this one...doesn't run unless called first-->
</xsl:copy>
</xsl:for-each>
</runcard_2>
</xsl:template>
<xsl:template match="runcard/workcenter/operation_list/operation/@*">
<xsl:copy/>
</xsl:template>
<xsl:template match="/runcard/workcenter/operation_list/@*">
<xsl:copy/>
</xsl:template>
<xsl:template match="/runcard/workcenter/@*">
<xsl:copy/>
</xsl:template>
--------------------------------------------
thanks for any and all help
mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu