[Home] [By Thread] [By Date] [Recent Entries]
Tom,
As it happens, I just helped someone solve this exact problem last week. So you are not alone. The simple answer to your question: <xsl:value-of select="fmp:METADATA/fmp:FIELD[3]@NAME"/> <xsl:value-of select="/*/fmp:METADATA/fmp:FIELD[3]/@NAME"/> would write the value of the third fmp:FIELD element of the fmp:METADATA element inside the FMPXMLRESULT document element. Note: * An extra step in front of the path, so it traverses from the root of the document, not the processing context of the XPath, and finds the fmp:METADATA element as a child of the document element (which it is) * A slash before @NAME, as that has to be a discrete step in the XPath. * Also, in the sample data you have, of course this won't get anything, as there are only two FIELD elements and you are asking for fmp:FIELD[3]. I hope that gets you moving. About the general problem, experience shows that: * The necessary operations are much easier in XSLT 2.0 than in XSLT 1.0, since XPath 2.0 offers a function, index-of(), which is lacking in XSLT 1.0 but which provides a bit of necessary information that is cumbersome to calculate without it, and * If you are stuck using XSLT 1.0, you will probably want to optimize your logic using variables and possibly a key. Otherwise you will have almost illegible code and probably n^2 performance or worse (depending on whether your processor optimizes internally for you). Good luck, Wendell At 02:26 PM 9/9/2008, you wrote: 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). ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|

Cart



