how to us for-each here ??
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 10
- Joined: Thu Dec 07, 2006 12:08 pm
how to us for-each here ??
Post by heldopslippers »
I have this XML file:
My XSL file needs to look for each FIELD. I tryed lots of things but doesn't work. The following code (I think) should work but doesn't. I hope someone can tell me what I do wrong..
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"/>
<METADATA>
<FIELD id="1" NAME="tekstvak">
<FIELD id="12" NAME="tekstvak1">
</METADATA>
</FMPXMLRESULT>

Code: Select all
<xsl:template match="/">
<xsl:element name="a">
<for-each select="/FS:FMPXMLRESULT/FS:METADATA/FS:FIELD" xmlns:FS="http://filemaker.com/fmpxmlresult" >
<xsl:element name="b">
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
There are many problems.
1. The XML file is not wellformed, the FMPXMLRESULT is empty, FIELD tags are not closed. The wellformed example after corrections is
The xsl file contains for-each instead of xsl:for-each and the namespace for the source elements is wrong, in stylesheet it is declared without www, compare http://filemaker.com/fmpxmlresult with http://www.filemaker.com/fmpxmlresult.
Correcting also the stylesheet gives
which works ok.
Regards,
George
1. The XML file is not wellformed, the FMPXMLRESULT is empty, FIELD tags are not closed. The wellformed example after corrections is
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<METADATA>
<FIELD id="1" NAME="tekstvak"/>
<FIELD id="12" NAME="tekstvak1"/>
</METADATA>
</FMPXMLRESULT>
Correcting also the stylesheet gives
Code: Select all
<xsl:template match="/">
<xsl:element name="a">
<xsl:for-each select="/FS:FMPXMLRESULT/FS:METADATA/FS:FIELD"
xmlns:FS="http://www.filemaker.com/fmpxmlresult">
<xsl:element name="b"> </xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
Regards,
George
George Cristian Bina
-
- Posts: 10
- Joined: Thu Dec 07, 2006 12:08 pm
Post by heldopslippers »
Thanxs for the fast replay.
and wel ...ehm sorry but I typed it over mist some things and had to sort out the things the aren't relevand
gr "heldop"
and wel ...ehm sorry but I typed it over mist some things and had to sort out the things the aren't relevand
gr "heldop"

Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service