Commit 658b4df8 authored by ap's avatar ap

Reviewed by Eric.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5609
          XSLT document() doesn't handle relative paths

        Test case: fast/xsl/xslt-relative-path.xml

        * khtml/xsl/xslt_processorimpl.cpp:
        (DOM::docLoaderFunc): Renamed from stylesheetLoadFunc. Use base URL when constructing URLs.
        (DOM::XSLTProcessorImpl::transformToString):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11849 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 07d08035
2006-01-03 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Eric.
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5609
XSLT document() doesn't handle relative paths
* fast/xsl/xslt-relative-path.xml: Added.
* fast/xsl/resources/findme.xml: Added.
* fast/xsl/xslt-relative-path-expected.txt: Added.
* fast/xsl/xslt-relative-path-expected.checksum: Added.
* fast/xsl/xslt-relative-path-expected.png: Added.
2005-12-30 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Darin.
......
<?xml version='1.0'?>
<foo>
<bar>Hello, Webkit!</bar>
</foo>
df52eccbf7b76dc63d00306672b32e09
\ No newline at end of file
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x118
RenderBlock {HTML} at (0,0) size 800x118
RenderBody {BODY} at (8,16) size 784x86
RenderBlock {P} at (0,0) size 784x18
RenderText {TEXT} at (0,0) size 511x18
text run at (0,0) width 511: "Here is an attempt to extract the string \"Hello, Webkit!\" from the file findme.xml:"
RenderBlock {P} at (0,34) size 784x18
RenderText {TEXT} at (0,0) size 377x18
text run at (0,0) width 283: "using document('file:resources/findme.xml'): "
text run at (283,0) width 94: "Hello, Webkit!"
RenderBlock {P} at (0,68) size 784x18
RenderText {TEXT} at (0,0) size 353x18
text run at (0,0) width 259: "using document('resources/findme.xml'): "
text run at (259,0) width 94: "Hello, Webkit!"
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="#stylesheet"?>
<!DOCTYPE doc [
<!ELEMENT xsl:stylesheet ANY>
<!ATTLIST xsl:stylesheet id ID #REQUIRED>
]>
<doc>
<xsl:stylesheet version="1.0" id="stylesheet" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="xsl:stylesheet"/>
<xsl:variable name="method1">file:resources/findme.xml</xsl:variable>
<xsl:variable name="method2">resources/findme.xml</xsl:variable>
<xsl:template match="doc">
<html>
<head>
<title>Testing Webkit</title>
</head>
<body>
<p>Here is an attempt to extract the string "Hello, Webkit!" from the file findme.xml:</p>
<p>using document('<xsl:value-of select="$method1"/>'):
<xsl:value-of select="document($method1)/foo/bar"/></p>
<p>using document('<xsl:value-of select="$method2"/>'):
<xsl:value-of select="document($method2)/foo/bar"/></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
</doc>
2006-01-03 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Eric.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5609
XSLT document() doesn't handle relative paths
Test case: fast/xsl/xslt-relative-path.xml
* khtml/xsl/xslt_processorimpl.cpp:
(DOM::docLoaderFunc): Renamed from stylesheetLoadFunc. Use base URL when constructing URLs.
(DOM::XSLTProcessorImpl::transformToString):
2006-01-02 Vicki Murley <vicki@apple.com>
Reviewed by Maciej.
......
......@@ -64,7 +64,7 @@ static void parseErrorFunc(void *ctxt, const char *msg, ...)
// FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals.
static XSLTProcessorImpl *globalProcessor = 0;
static khtml::DocLoader *globalDocLoader = 0;
static xmlDocPtr stylesheetLoadFunc(const xmlChar *uri,
static xmlDocPtr docLoaderFunc(const xmlChar *uri,
xmlDictPtr dict,
int options,
void* ctxt,
......@@ -75,7 +75,8 @@ static xmlDocPtr stylesheetLoadFunc(const xmlChar *uri,
switch (type) {
case XSLT_LOAD_DOCUMENT: {
KURL url = KURL((char *)uri);
xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt;
KURL url((const char *)xmlNodeGetBase(context->document->doc, context->node), (const char *)uri);
KURL finalURL;
KIO::TransferJob *job = KIO::get(url, true, false);
QByteArray data;
......@@ -296,7 +297,7 @@ bool XSLTProcessorImpl::transformToString(NodeImpl *sourceNode, QString &mimeTyp
RefPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
RefPtr<XSLStyleSheetImpl> cachedStylesheet = m_stylesheet;
setXSLTLoadCallBack(stylesheetLoadFunc, this, ownerDocument->docLoader());
setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->docLoader());
xsltStylesheetPtr sheet = xsltStylesheetPointer(cachedStylesheet, m_stylesheetRootNode.get());
if (!sheet) {
setXSLTLoadCallBack(0, 0, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment