WebKit and XSLT
WebKit and XSLT
- Subject: WebKit and XSLT
- From: Kiel Gillard <email@hidden>
- Date: Thu, 16 Jun 2005 01:34:54 +1000
Hi all,
I have an instance of a WebView in my user interface that
successfully transforms some XML. However, I'd like to add a feature
where the transformation is saved as a HTML file, as opposed to the
entire XML. I was wondering how could I do this?
I'm aware of NSXMLDocument but I'm trying to write my app for Mac OS
X 10.3 users too.
What happens at the moment is if I transform the XML in Safari (or
via a WebView in my app) and view the source, I get the entire XML. I
would like to save the HTML that is being rendered by Safari. Can
anyone please help me?
Here is some example code. If you try this in Safari, it'll transform
it but if you view the source, it simply regurgitates the XML file
back to me. I'd like to see (and when I'm in my app, save) the HTML
the XML was transformed to:
Cats.xml (Please note the value for the href attribute in the second
line)
------------------------------------------------------------------------
------------------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xml" href="absolute path to xsl file"?>
<cats>
<cat>
<name>Jaguar</name>
<os-x>10.2</os-x>
</cat>
<cat>
<name>Panther</name>
<os-x>10.3</os-x>
</cat>
<cat>
<name>Tiger</name>
<os-x>10.4</os-x>
</cat>
</cats>
Cats.xsl
------------------------------------------------------------------------
------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:output method="html" media-type="html" doctype-system="http://
www.w3.org/TR/xhtml1/DTD/xhml1-transitional.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" indent="yes"/>
<xsl:template match="/cats">
<html>
<head></head>
<body>
<h1>Cat Names</h1>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="cat">
<ul>
<li><xsl:value-of select="name"/></li>
</ul>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------
------------------
------------------------------------------------------------------------
------------------
Thanks in advance,
Kiel :-)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden