problem..
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 10
- Joined: Thu Dec 07, 2006 12:08 pm
problem..
Post by heldopslippers »
I hava this XML file
<a name="1">
<b name="2">
</b>
</a>
I would like to get the name from b
I thought this but doesn't work:
<xsl:value-of select="/b/@NAME"/>
I hope someone can help me out
<a name="1">
<b name="2">
</b>
</a>
I would like to get the name from b
I thought this but doesn't work:
<xsl:value-of select="/b/@NAME"/>
I hope someone can help me out
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Hi,
You have two mistakes in the select.
First of all, everything in XSL (and XML in general) is case sensitive so the attribute name must be written "name" and not "NAME".
Then, if you begin an XPath with a "/" it means it's absolute which in your case is not true.
So the select XPath value should read:
Regards,
Radu
You have two mistakes in the select.
First of all, everything in XSL (and XML in general) is case sensitive so the attribute name must be written "name" and not "NAME".
Then, if you begin an XPath with a "/" it means it's absolute which in your case is not true.
So the select XPath value should read:
Code: Select all
<xsl:value-of select="/a/b/@name"/>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 10
- Joined: Thu Dec 07, 2006 12:08 pm
-
- Posts: 10
- Joined: Thu Dec 07, 2006 12:08 pm
Post by heldopslippers »

this is my new example:
Code: Select all
<FMPXMLRESULT xmlns="http://www.filenaker.com/fmpxmlresult">
<DATABASE NAME="filemaker" />
</FMPXMLRESULT>
Code: Select all
<xsl:value-of select="/FMPXMLRESULT/DATABASE/@NAME" />
(and for radu it works on my first example but not this one)
gr "heldopslippers"

-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Hi,
The difference is that all the elements in your second XML fragment are in the "http://www.filenaker.com/fmpxmlresult" namespace so one way to access the attribute value is to bind the namespace to a prefix and use the prefix in the XPath like:
I recommend reading this tutorial http://www.zvon.org/xxl/XSLTutorial/Output/index.html about stylesheets.
We also have more tutorial links here:
http://www.oxygenxml.com/tutorials.html
Regards,
Radu
The difference is that all the elements in your second XML fragment are in the "http://www.filenaker.com/fmpxmlresult" namespace so one way to access the attribute value is to bind the namespace to a prefix and use the prefix in the XPath like:
Code: Select all
<xsl:value-of select="/FS:FMPXMLRESULT/FS:DATABASE/@NAME" xmlns:FS="http://www.filenaker.com/fmpxmlresult"/>
We also have more tutorial links here:
http://www.oxygenxml.com/tutorials.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 10
- Joined: Thu Dec 07, 2006 12:08 pm
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