Subject: Re: [xsl] accessing attributes From: "Tom Wright" <tom@xxxxxxxxxxxx> Date: Tue, 09 Sep 2008 14:45:52 -0400 |
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]@NAME"/> </xsl:template> </xsl:stylesheet>
Many thanks tom
<tr><td> <xsl:param name="pos" select="position()"/> <xsl:value-of select="fmp:METADATA/fmp:FIELD[$pos]/@NAME"/> <xsl:value-of select="@NAME"/> </td></tr> </xsl:for-each>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] accessing attributes, Tom Wright | Thread | Re: [xsl] accessing attributes, Wendell Piez |
[xsl] accessing attributes, Tom Wright | Date | Re: [xsl] accessing attributes, Wendell Piez |
Month |