Discussion:
[xquery-talk] Serialize xml to html5 with php.
France Baril
2014-11-27 15:33:21 UTC
Permalink
Hi,

I was trying to use BaseX to export files that contain some php code, and
after xml to html5 serialization <?php ... ?> becomes <?php ...>.

They suggested I contact this list to enquire about any option to export
the php with the closing '?'?
--
France Baril
Architecte documentaire / Documentation architect
***@architextus.com
Michael Seiferle
2014-11-27 16:00:06 UTC
Permalink
Hi France,


I started toying around, here are three more or less pragmatic
approaches :-)

Are you required to use html(5) serialization? From what I understand
processing instructions in HTML are serialized differently, '?>'
serializes to '>':
http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.3.6
(there may be a better source for this behavior, but this is what I
found).

In case you are not, you could work around this using xhtml
declare option output:method "xhtml";
<x>
<?php print "Hi" ?>
<input/>
</x>
declare option output:method "html";
declare option output:html-version "5.0";
<x>
<?php haha ??>
<input/>
</x>
or you could make use of PHPs script syntax:
http://php.net/manual/en/language.basic-syntax.phpmode.php
<script language="php">
echo 'some editors (like FrontPage) don\'t
like processing instructions';
</script>
Best

Michael
Hi,
I was trying to use BaseX to export files that contain some php code, and
after xml to html5 serialization <?php ... ?> becomes <?php ...>.
They suggested I contact this list to enquire about any option to export
the php with the closing '?'?
--
France Baril
Architecte documentaire / Documentation architect
_______________________________________________
http://x-query.com/mailman/listinfo/talk
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk
France Baril
2014-12-10 23:09:40 UTC
Permalink
Hi, solution #2 was the best option.

#1 was not an option in our context and #3 did not work in every browser.
Post by Michael Seiferle
Hi France,
I started toying around, here are three more or less pragmatic approaches
:-)
Are you required to use html(5) serialization? From what I understand
processing instructions in HTML are serialized differently, '?>' serializes
http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.3.6
(there may be a better source for this behavior, but this is what I found).
declare option output:method "xhtml";
<x>
<?php print "Hi" ?>
<input/>
</x>
declare option output:method "html";
declare option output:html-version "5.0";
<x>
<?php haha ??>
<input/>
</x>
or you could make use of PHPs script syntax: http://php.net/manual/en/
language.basic-syntax.phpmode.php
<script language="php">
echo 'some editors (like FrontPage) don\'t
like processing instructions';
</script>
Best
Michael
Hi,
I was trying to use BaseX to export files that contain some php code, and
after xml to html5 serialization <?php ... ?> becomes <?php ...>.
They suggested I contact this list to enquire about any option to export
the php with the closing '?'?
--
France Baril
Architecte documentaire / Documentation architect
_______________________________________________
http://x-query.com/mailman/listinfo/talk
--
France Baril
Architecte documentaire / Documentation architect
***@architextus.com
Continue reading on narkive:
Loading...