select child element of xPath with axes
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 26
- Joined: Tue Dec 22, 2009 2:40 pm
select child element of xPath with axes
Post by metalhammer »
Hi,
I want the title of my html file to be the value of a grandchild element from a xPath with axes.
That doesn't sounds as a clear explanation, but I'll try to clear it out.
This is a shortened version of my xml file:
I want "EskoArtwork XMP example file" to be the title of my html file.
I've tried the following code, but it doesn't work.
I want the title of my html file to be the value of a grandchild element from a xPath with axes.
That doesn't sounds as a clear explanation, but I'll try to clear it out.
This is a shortened version of my xml file:
Code: Select all
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<?xml-stylesheet type="text/xsl" href="XMP_omvormen.xslt"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:05:41 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate>2007-07-04T16:36:14+02:00</xmp:CreateDate>
<xmp:CreatorTool>Esko PackEdge 7.0 NT Jun 26 2007, build 627</xmp:CreatorTool>
<xmp:MetadataDate>2007-07-04T16:36:16+02:00</xmp:MetadataDate>
<xmp:ModifyDate>2007-07-04T16:36:16+02:00</xmp:ModifyDate>
<xmp:Rating>4</xmp:Rating>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>application/pdf</dc:format>
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">esko pdf example file </rdf:li>
</rdf:Alt>
</dc:description>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">EskoArtwork XMP example file</rdf:li>
</rdf:Alt>
</dc:title>
<dc:creator>
<rdf:Seq>
<rdf:li>EskoArtwork</rdf:li>
</rdf:Seq>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>Esko</rdf:li>
<rdf:li>Artwork</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</x:xmpmeta>
<?xpacket end="w"?>
I've tried the following code, but it doesn't work.
Code: Select all
<title>
<xsl:value-of select="rdf:Description[
namespace::*[.='http://purl.org/dc/elements/1.1/']
]/dc:title/rdf:Alt/rdf:li"/>
</title>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: select child element of xPath with axes
Please post a working sample to allow to easy reproduce the issue. Your XML fragment is not wellformed and the XSLT fragment is out of context and the problem is probably exactly in the part that is missing.
Your code works for me putting it in the right template and with the appropriate namespace declarations, after I corrected the XML file:
Regards,
George
Your code works for me putting it in the right template and with the appropriate namespace declarations, after I corrected the XML file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0">
<xsl:template match="rdf:RDF">
<title>
<xsl:value-of select="rdf:Description[namespace::*[.='http://purl.org/dc/elements/1.1/']]/dc:title/rdf:Alt/rdf:li"/>
</title>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<?xml-stylesheet type="text/xsl" href="XMP_omvormen.xslt"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:05:41 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate>2007-07-04T16:36:14+02:00</xmp:CreateDate>
<xmp:CreatorTool>Esko PackEdge 7.0 NT Jun 26 2007, build 627</xmp:CreatorTool>
<xmp:MetadataDate>2007-07-04T16:36:16+02:00</xmp:MetadataDate>
<xmp:ModifyDate>2007-07-04T16:36:16+02:00</xmp:ModifyDate>
<xmp:Rating>4</xmp:Rating>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>application/pdf</dc:format>
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">esko pdf example file </rdf:li>
</rdf:Alt>
</dc:description>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">EskoArtwork XMP example file</rdf:li>
</rdf:Alt>
</dc:title>
<dc:creator>
<rdf:Seq>
<rdf:li>EskoArtwork</rdf:li>
</rdf:Seq>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>Esko</rdf:li>
<rdf:li>Artwork</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
George
George Cristian Bina
-
- Posts: 26
- Joined: Tue Dec 22, 2009 2:40 pm
Re: select child element of xPath with axes
Post by metalhammer »
I solved it, the problem was with the template.
I changed
to
like in your code.
Thanks for your help!
I changed
Code: Select all
<xsl:template match="/">
Code: Select all
<xsl:template match="rdf:RDF">
Thanks for your help!
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