xsl-list
[Top] [All Lists]

RE: Colon Error in Processing-Instruction Name

2004-08-19 00:21:48
XSLT requires that the name in <xsl:processing-instruction> should be an
NCName (no-colon-name) in order to make it valid in namespace-aware-XML. 

So there is no way of generating the HTML you want to generate. You could
use d-o-e as David Carlisle suggests, or do some post-processing with a text
editor.

Michael Kay 

-----Original Message-----
From: Trevor Majic [mailto:majic87(_at_)hotmail(_dot_)com] 
Sent: 18 August 2004 16:16
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Colon Error in Processing-Instruction Name

I have a processing-instruction that works in HTML, but when 
I include it in 
my XSL, I receive an error stating the name cannot include 
colons (namespace 
conflict).

This is the processing-instruction as it appears in the HTML file:

<?IS10744:arch name="linkone-enabled"
     public-id="-//LinkOne//NOTATION AFDR ARCBASE Linkone enabled//EN"
        auto=nArcAuto?>


Obviously, when I try to add this as a processing-instruction 
in XSL, I 
receive an error message.  This is the XSL processing 
instruction I used:

<xsl:processing-instruction name="IS10744:arch">
     name="linkone-enabled"
     public-id="-//LinkOne//NOTATION AFDR ARCBASE Linkone 
enabled//EN" 
auto=nArcAuto
</xsl:processing-instruction>


Since the name can't include a colon (IS10744:arch), an error 
is generated.

I have found two suggested work-arounds:

     1. Replace the colon with a space or a dash.  This 
however does not 
work.  If I replace the colon in the HTML file, the page does 
not display 
correctly (it is missing the Linkone selection box).

     2. Turn off namespace.  I suspect there are some issues 
with doing 
that.  First off, I don't know how to do it.  Also, If I turn off the 
namespace, will that turn off the namespace validation for the whole 
document, or just for the data within the section where it is 
turned-off.

NOTE: I may be incorrect in some of this, so feel free to 
correct me if I am 
wrong, or using wrong terminology.

I can't add the colon after the processing name (ie. 
.....name=IS10744>:arch 
..... as the output will be <?IS10744 :arch.....

An error message is generated if I use an empty name (ie. 
....name="">IS10744:arch name....).  Plus, the output 
wouldn't work in the 
HTML document, as it would be <? IS10744 (space between ? and 
IS10744).

I don't seem to be able to use a predefined general entity 
(ie &#58) to 
replace the colon.


This is the HTML file which works:

<?IS10744:arch
    name="linkone-enabled"
    public-id="-//LinkOne//NOTATION AFDR ARCBASE Linkone enabled//EN"
    auto=nArcAuto?>
<html xmlns="http://www.w3.org/TR/REC-html40";>

<table>
  <tr linkone-enabled="entry">
  <td linkone-enabled="field" le-name="Stock Code" 
le-select="always">500100</td>
  <td linkone-enabled="field" le-name="Part Number" 
le-select="hide">WR151-12</td>
  <td>3/4&quot; Wrench</td>
  <td>ea</td>
  </tr>
</table>




This is my XML:

<?xml version="1.0"?>
<?xml:stylesheet type='text/xsl' href='StockCodesStylesheet.xsl'?>

<stockcodes>
    <indivitems>
            <groupcode>Bolts</groupcode>
            <stockcode>0015236</stockcode>
            <uoi>Ea</uoi>

        <supplier>
                <suppliername>ABC Supplies</suppliername>

              <supplieraddress>
                      <supplierstreet>123 Maple Way</supplierstreet>
            <suppliercity>Wpg</suppliercity>
            <supplierpostal>R3J2E7</supplierpostal>
              </supplieraddress>
          </supplier>

            <stockdescriptions>
                <description1>Bolt</description1>
                <description2>1/2 inch</description2>
            </stockdescriptions>

            <partnumber>12bbdgr531</partnumber>
</indivitems>



This is the 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" indent="yes"/>

<xsl:template match="stockcodes">

    <xsl:processing-instruction 
name="IS10744:arch)">name="linkone-enabled"
        public-id="-//LinkOne//NOTATION AFDR ARCBASE Linkone 
enabled//EN" 
auto=nArcAuto
    </xsl:processing-instruction>

         <table>
             <xsl:for-each select="indivitems">
             <tr linkone-enabled="entry">
                  <td linkone-enabled="field" le-name="part-number" 
le-select="always">233355</td>
                  <td linkone-enabled="field" 
le-name="Description"><xsl:value-of 
select="stockdescriptions/description2"/></td>
                  <td><xsl:value-of select="uoi"/></td>
               </tr>
              </xsl:for-each>
          </table>
    </xsl:template>
</xsl:stylesheet>



What do I need to do to fix this?

Thank you,
Trevor

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today 
- it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>