[oXygen-user] Problems with trivial xhtml --> xml xslt

Betty Harvey harvey at eccnet.com
Fri Feb 24 15:39:17 CST 2012


Hi John:

It is namespace issue.  Notice your HTML instance has a namespace
declaration.

Add the following namespace to your xsl:stylesheet declaration:

 xmlns:html="http://www.w3.org/1999/xhtml"

Use the html: prefix to grab the title and you should be good to go.

 <xsl:value-of select="html:html/html:head/html:title" />

Good luck!

Betty


> Hi,
>
> I am pretty much going crazy here trying to capture an xhtml title value
> and present it within some xml output.
> The xhtml
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
>         <title>Building Standards Domestic Handbook - General</title>
>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8"/>
>     <meta name="keywords" content="Building Standards Scotland, Technical
> Handbooks, Domestic, 2010" />
> </head>
>
> My XSL
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:ukm="http://www.legislation.gov.uk/namespaces/metadata"
>     xmlns:ukl="http://www.legislation.gov.uk/namespaces/legislation"
>     xmlns:dc="http://purl.org/dc/elements/1.1"
>     xmlns:dct="http://purl.org/dc/terms"
>     xmlns:atom="http://www.w3.org2005/Atom"
>     xsi:schemaLocation="http://www.legislation.gov.uk/namespaces/legislation
>     http://www.legislation.gov.uk/schema/schemaLegislationBase-v1-0.xsd"
>     xml:base="http://www.legislation.gov.uk/id/ssi/2011/120"
>     exclude-result-prefixes="xs xd"
>     version="2.0" >
>     <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
>     <xsl:strip-space elements="*"/>
>     <xd:doc scope="stylesheet">
>         <xd:desc>
>             <xd:p><xd:b>Created on:</xd:b> Feb 21, 2012</xd:p>
>             <xd:p><xd:b>Author:</xd:b> lewismc</xd:p>
>             <xd:p></xd:p>
>         </xd:desc>
>     </xd:doc>
>     <xsl:template match="/">
>         <Legislation>
>             <ukm:Metadata>
>                 <dc:title>
>                    <xsl:value-of select="html/head/title" />
>                 </dc:title>
>        all closing tags are present
>
> I apologies for the really newbie question, but I've been stuck on this
> for quite literally an hour or so and the only output I can get is by
> replacing xsl:value of with ".", which returns the full xhtml page... not
> what I want.
>
> Any help would be greatly appreciated.
>
> Kind Regards and thank you in advance.
>
> Lewis
>
>
> Lewis John McGibbney BSc (Hons), ICIOB, GCInstCES
> PhD Researcher Informatics in Design and Construction
> School of Engineering and Built Environment
> Glasgow Caledonian University
> 0141 331 8420
> lewis.mcgibbney at gcu.ac.uk
>
> Glasgow Caledonian University is a registered Scottish charity, number
> SC021474
>
> Winner: Times Higher Education’s Widening Participation Initiative of
> the Year 2009 and Herald Society’s Education Initiative of the Year
> 2009.
> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
>
> Winner: Times Higher Education’s Outstanding Support for Early Career
> Researchers of the Year 2010, GCU as a lead with Universities Scotland
> partners.
> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>


/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone:  410-787-9200  FAX: 9830
Electronic Commerce Connection, Inc. |
harvey at eccnet.com                    | Washington,DC XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
Member of XML Guild (www.xmlguild.org)


More information about the oXygen-user mailing list