xsl-list
[Top] [All Lists]

RE: Dive routine

2005-02-15 23:25:11
Hi,

It's been a while since I've used XSL and now I've got to 
pull something 
together in short order.
I need to go from this:

    <model rootview="1721678891107373384457">
        <views>
            <view viewref="1721678891107373384457"
    noderef="1721678891107376948629"/>
            <view viewref="1721678891107373384457"
    noderef="1721679701107199037296"/>
            <view viewref="1721678891107373384457"
    noderef="1721679701107365990562"/>
            <view viewref="1721679701107365990562"
    noderef="1721679701107366055468"/>
            <view viewref="1721679701107365990562"
    noderef="1721679701107366004593"/>
        </views>
        <nodes>
            <node id="1721678891107373384457" type="2" label="Sales :
    New Hire Agenda" state="-1"/>
            <node id="1721678891107376948629" type="9"
    label="http://www.whatever.com/filename.pdf"; state="-1"/>
            <node id="1721679701107199037296" type="10" label="No
    objectives" state="-1"/>
            <node id="1721679701107365990562" type="2" label="ITSEC"
    state="-1"/>
            <node id="1721679701107366055468" type="9"
    label="https://pivot.earthlink.net/DesktopDefault.aspx?tabid=1291";
    state="-1"/>
            <node id="1721679701107366004593" type="9"
    label="Information Technology Security Document. " state="-1"/>
        </nodes>
    </model>

to this:

    <node data="1721678891107373384457" label="Sales : New 
Hire Agenda">
        <node data="1721678891107376948629"
    label="http://www.whatever.com/filename.pdf";></node>
        <node data="1721679701107199037296" label="No 
objectives"></node>
        <node data="1721679701107365990562" label="ITSEC">
            <node data="1721679701107366055468"
    
label="https://pivot.earthlink.net/DesktopDefault.aspx?tabid=1
291"></node>
            <node data="1721679701107366004593" label="Information
    Technology Security Document.">
        </node>
    </node>

  <xsl:key name="view" match="view" use="@viewref"/>
  <xsl:key name="node" match="node" use="@id"/>
  <xsl:template match="model">
    <xsl:apply-templates select="key('node', @rootview)"/>
  </xsl:template>
  <xsl:template match="node">
    <xsl:copy>
      <xsl:copy-of select="@label"/>
      <xsl:attribute name="data">
        <xsl:value-of select="@id"/>
      </xsl:attribute>
      <xsl:for-each select="key('view', @id)">
        <xsl:apply-templates select="key('node', @noderef)"/>
      </xsl:for-each>
    </xsl:copy>
  </xsl:template>

Cheers,

Jarno - Nick Sentience: March 2003 Mix

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • Dive routine, Erick Emde
    • RE: Dive routine, Jarno.Elovirta <=