XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 26
- Joined: Wed Jan 12, 2022 1:07 pm
XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Hi,
I’m trying to write a lightweight refactoring XSLT stylesheet.
To begin with, I just copied that over from existing stylesheets;
So basically, this does nothing. However, when I try to execute it using the Tools → Refactoring dialogue, I always get this fatal error:
‘System ID: /Users/vincent/Documents/DITA/Refactoring/ddtable.xsl
Severity: fatal
Problem ID: XPST0003
Description: A processing instruction must not be named 'xml' in any combination of upper and lower case
Start location: 1:0
URL: http://www.w3.org/TR/xpath20/#ERRXPST0003’
Googling that error finds things about Xquery, but I’m not sure to understand how it is related to an XSLT stylesheet, and what to do about it.
Thanks,
Vincent
I’m trying to write a lightweight refactoring XSLT stylesheet.
To begin with, I just copied that over from existing stylesheets;
Code: Select all
<?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"
exclude-result-prefixes="xs"
xmlns:xr="http://www.oxygenxml.com/ns/xmlRefactoring"
version="2.0">
<xsl:import href="http://www.oxygenxml.com/ns/xmlRefactoring/resources/commons.xsl"/>
<!-- default copy template -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
‘System ID: /Users/vincent/Documents/DITA/Refactoring/ddtable.xsl
Severity: fatal
Problem ID: XPST0003
Description: A processing instruction must not be named 'xml' in any combination of upper and lower case
Start location: 1:0
URL: http://www.w3.org/TR/xpath20/#ERRXPST0003’
Googling that error finds things about Xquery, but I’m not sure to understand how it is related to an XSLT stylesheet, and what to do about it.
Thanks,
Vincent
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Hi Vincent,
I created a folder on disk containing a "refactor.xsl" with your XSLT content and a "refactor.xml" which looks like this:
Afterwards I used this refactoring action named "CUSTOM OPERATION NAME" on my side on a small XML document and it worked (it preserved the XML exactly as it is and did not report that error).
Maybe this is somehow related to the XML document you want to refactor, is that XML document valid when opened in Oxygen?
Regards,
Radu
I created a folder on disk containing a "refactor.xsl" with your XSLT content and a "refactor.xml" which looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<refactoringOperationDescriptor
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.oxygenxml.com/ns/xmlRefactoring" id="some_UNIQUE_ID" name="CUSTOM OPERATION NAME">
<description>The description of the operation.</description>
<script type="XSLT" href="refactor.xsl"/>
</refactoringOperationDescriptor>
Maybe this is somehow related to the XML document you want to refactor, is that XML document valid when opened in Oxygen?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 26
- Joined: Wed Jan 12, 2022 1:07 pm
Re: XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Thanks Radu!
In fact, my descriptor looked like this:
I didn't pay attention to the "XQUERY_UPDATE" type, because I dumbly copied that from the online example!
Thanks a bunch for your answer,
Vincent
In fact, my descriptor looked like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<refactoringOperationDescriptor
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.oxygenxml.com/ns/xmlRefactoring"
id="ddtable"
name="Move tables outside of DL">
<description>Take tables outside of dd elements.</description>
<!-- For the XSLT stylesheet option uncomment the following line and comment
the line referring the XQuery Update script -->
<!-- <script type="XSLT" href="convert-attribute-to-element.xsl"/> -->
<script type="XQUERY_UPDATE" href="ddtable.xsl"/>
</refactoringOperationDescriptor>
Thanks a bunch for your answer,
Vincent
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Hi Vincent,
Right, it's clear now.
I also created some time ago a free GitHub project with lots of refactoring actions if you find anything interesting there:
https://github.com/oxygenxml/dita-refactoring-examples
Regards,
Radu
Right, it's clear now.
I also created some time ago a free GitHub project with lots of refactoring actions if you find anything interesting there:
https://github.com/oxygenxml/dita-refactoring-examples
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 26
- Joined: Wed Jan 12, 2022 1:07 pm
Re: XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Radu,
thanks a bunch for the pointer. I’ll have a look and pick whatever seems handy
Also, how would you put a tag in comment? i.e. transform
<whatever> … </whatever>
into
<!-- <whatever> … </whatever> -->
Thanks!
thanks a bunch for the pointer. I’ll have a look and pick whatever seems handy

Also, how would you put a tag in comment? i.e. transform
<whatever> … </whatever>
into
<!-- <whatever> … </whatever> -->
Thanks!
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Hi Vincent,
It would have been cool if something like this worked:
but unfortunately it just saves the plain text content inside the created comment.
This works:
https://stackoverflow.com/questions/192 ... ment-block
but you may have problems if the serialized XML element contains inside it other XML comments.
Regards,
Radu
It would have been cool if something like this worked:
Code: Select all
<xsl:template match="toRemove">
<xsl:comment select="."/>
</xsl:template>
This works:
https://stackoverflow.com/questions/192 ... ment-block
Code: Select all
<xsl:text disable-output-escaping="yes"><!--</xsl:text>
<xsl:copy-of select="."/>
<xsl:text disable-output-escaping="yes">--></xsl:text>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 26
- Joined: Wed Jan 12, 2022 1:07 pm
Re: XSLT refactoring not working ('A processing instruction must not be named 'xml' …)
Ah, that’s the
TBH, I’m trying to write a more complex transform, i.e. pulling a <table> element outside its parent <dl> element, but not placing it before or after. Instead, the <dl> element must end before the table, and resume just after. It is a simple matter of inserting </dlentry></dl> before the table and <dl><dlentry> after it, so what you told me is probably going to be enough.
Thanks again,
Vincent
PS: It doesn’t work. I’m getting '<' in the transformed file. But never mind, I just gave up the idea of coding that transformation for the time being. It is quite complex and needs more thought than… I thought :p The solution I wrote above won’t work: I’m left with a dangling </dd> that I must get rid of, and it’s a pain. On the other hand, recreating a whole set of <dd> nodes with their sub-nodes is really a convoluted task.
part I wasn't familiar with. thanks!disable-output-escaping
TBH, I’m trying to write a more complex transform, i.e. pulling a <table> element outside its parent <dl> element, but not placing it before or after. Instead, the <dl> element must end before the table, and resume just after. It is a simple matter of inserting </dlentry></dl> before the table and <dl><dlentry> after it, so what you told me is probably going to be enough.
Thanks again,
Vincent
PS: It doesn’t work. I’m getting '<' in the transformed file. But never mind, I just gave up the idea of coding that transformation for the time being. It is quite complex and needs more thought than… I thought :p The solution I wrote above won’t work: I’m left with a dangling </dd> that I must get rid of, and it’s a pain. On the other hand, recreating a whole set of <dd> nodes with their sub-nodes is really a convoluted task.
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