xsl-list
[Top] [All Lists]

[xsl] accessing attributes

2008-09-09 14:28:07
Hi everyone,
I'm new to this so please forgive any missing information etc.
I'm trying to write an xslt style sheet to transform the xml output from a filemaker database and I'm running into a few issues. My processor allows XSL v1.0 with library libxslt (running using PHP so looks like this is all I can get).

The filemaker output gives the field names in a metadata node, with the data coming later:

<?xml version="1.0" encoding="UTF-8" ?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult";>
<METADATA>
        <FIELD NAME="F1"/>
        <FIELD NAME="F2"/>
</METADATA>
<DATA>    
        <ROW>
          <COL><DATA>V1</DATA></COL>
          <COL><DATA>V2</DATA></COL>
        </ROW>
        <ROW>
          <COL><DATA>V3</DATA></COL>
          <COL><DATA>V4</DATA></COL>
        </ROW>
</DATA>



Basically I want to be able to relate each column value to it's name in the METADATA. However I'm not that far yet. To start with can someone please tell me how I should be writing this xsl:value-of element?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                              xmlns:fmp="http://www.filemaker.com/fmpxmlresult";
                              exclude-result-prefixes="fmp">

<xsl:template match="fmp:FMPXMLRESULT">
<xsl:value-of select="fmp:METADATA/fmp:FIELD[3](_at_)NAME"/>
</xsl:template>
</xsl:stylesheet>


Many thanks
tom

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