Closed Bug 70882 Opened 24 years ago Closed 22 years ago

Transformiix does not handle embedded stylesheets.

Categories

(Core :: XSLT, defect, P5)

x86
All
defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: darkmane, Assigned: keith)

Details

Attachments

(2 files, 1 obsolete file)

Section 2.7 of the Spec talks about embedded stylesheets.

Standalone transformiix says it cannot open the file for the embedded stylesheets.
Attached file Test Case
confirming and futuring this one.
How would we want to do this? Create a mockup document?

Axel
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → Future
Note: I am not a good C++ programer and I have little experience working with
streams.

I suggest that we read the stylesheet element into a stream and pass that stream
to the function described at

http://lxr.mozilla.org/seamonkey/source/extensions/transformiix/source/xslt/XSLTProcessor.h#157
I did some investigating on this. This won't be possible without implementing
GetElementByID. That would probably be more work than it's worth for standalone.
However, don't we already have this for the module? 

If so, implementing this should not be that difficult. I was able to get a
possible solution until if found out getElementByID was just a stub, so anybody
should be able to get it working.
Priority: -- → P5
Attached patch patch v1 (obsolete) — Splinter Review
patch that implements embedded stylesheet for module and standalone. Note
however that since standalone doesn't support getElementById it still won't
work. However implementing getElementById is IMO a different bug.

The patch also fixes bug 97621 since otherwise we'd go in a neverending
recursion when the embedded stylesheet is embedded in the source doc
Comment on attachment 71194 [details] [diff] [review]
missed part of the patch

>@@ -100,15 +103,33 @@
> NS_IMETHODIMP 
> nsXSLContentSink::DidBuildModel(PRInt32 aQualityLevel)
> {  
>-  nsCOMPtr<nsIDOMNode> styleDoc;
>-  nsresult rv;
>-
>   mDocument->SetRootContent(mDocElement);
>   mDocument->EndLoad();
>-  styleDoc = do_QueryInterface(mDocument, &rv);
>-  if (NS_SUCCEEDED(rv) && mXSLTransformMediator) {
>+
>+  nsCOMPtr<nsIDOMNode> styleNode;
>+  nsCOMPtr<nsIURL> url = do_QueryInterface(mDocumentURL);
>+  if (url) {
>+      nsXPIDLCString ref;
>+      url->GetRef(getter_Copies(ref));
>+      if (!ref.IsEmpty()) {
>+          nsCOMPtr<nsIDOMDocument> styleDoc = do_QueryInterface(mDocument);
>+          NS_ENSURE_TRUE(styleDoc, NS_ERROR_NO_INTERFACE);

Not sure if you should use NS_ERROR_NO_INTERFACE here. I thought that was used
for functions where you pass in an interface and expect something back.

>@@ -2344,7 +2375,18 @@
>         importFrame.addAfter(new ProcessorState::ImportFrame(0));
>         if (!importFrame.next())
>             return NS_ERROR_OUT_OF_MEMORY;
>-        processStylesheet(&sourceDocument, &xslDocument, &importFrame, &ps);
>+        nsCOMPtr<nsIDOMDocument> styleDoc = do_QueryInterface(aStyleDOM);
>+        if (styleDoc) {
>+            processStylesheet(&sourceDocument, &xslDocument, &importFrame,
>+                              &ps);
>+        }
>+        else {
>+            nsCOMPtr<nsIDOMElement> styleElem = do_QueryInterface(aStyleDOM);
>+            NS_ENSURE_TRUE(styleElem, NS_ERROR_FAILURE);
>+            Element* element = xslDocument.createElement(styleElem);
>+            NS_ENSURE_TRUE(styleElem, NS_ERROR_OUT_OF_MEMORY);

You mean element instead of styleElem.

r=peterv.
Attachment #71194 - Flags: review+
Attachment #71137 - Attachment is obsolete: true
Attachment #71137 - Flags: review+
changed styleElem -> element locally. Didn't change the errorcode (peterv was 
ok with that)
Status: NEW → ASSIGNED
Comment on attachment 71194 [details] [diff] [review]
missed part of the patch

sr=jst
Attachment #71194 - Flags: superreview+
Comment on attachment 71194 [details] [diff] [review]
missed part of the patch

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #71194 - Flags: approval+
upps, this was fixed a long time ago
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
we didn't verify for a long time.
I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: