xsl-list
[Top] [All Lists]

Selecting an element by a dynamic attribute value

2006-01-24 05:06:29
Dear all,

I have an XML file which looks something like this:

--------------------------------------------------------------

<results>
        <graphs>
                <graph label="foo" file="graph0.gif"/>
                <graph label="bar" file="graph1.gif"/>
                <graph .... etc />
        </graphs>

        <data>
                <run label="foo">
                        <some data elements>
                        </some data elements>
                </run>
                <run label="bar">
                        <some data elements>
                        </some data elements>
                </run>
        </data>
</results>

---------------------------------------------------------------

For irritating reasons, the graphs part and the data part are produced by
two different pieces of code, so can't be combined (the file attribute of
<graph> elements can't be inserted into the <run> elements in the xml file).

I would like to render this using xsl. I have up to now just been rendering
the <data> element in the xml file, using an <xsl:for-each> to loop around
the <run> elements.

I would like to insert into each of the <run> element renderings an html
<img> element. This <img> element would have an href attribute being the
value of the file attribute of the <graph> element with matching label (i.e.
the same label attribute value as the <run> element I am currently
rendering). Is there any way to do this?

Many thanks in advance for your help,

Rupert Parson



--~------------------------------------------------------------------
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>