XSLTProcessor::importStylesheet()中存在多个PHP警告

XSLTProcessor::importStylesheet()中存在多个PHP警告,php,xml,xslt,Php,Xml,Xslt,错误: XSL: //第18行 //第22行 (.) 停止 : XML: 确认患者无脉搏和呼吸暂停。 开始或继续CPR。除除颤期间和/或因转移患者而中断10秒外,CPR应始终持续进行。 确保气道通畅并开始使用BVM。提供初始BLS气道管理,包括口咽或鼻咽气道。 如果可用,应用AED或SAED。如果AED已经到位,等待当前电击序列完成,切换到另一个AED或手动监护仪-如果与新装置兼容,可以使用先前应用的补丁。 遵循AED/SAED设备提供的提示。 利用ALS,或启动向ALS的及时运输(

错误:

XSL:


//第18行
//第22行
(.) 
停止
: 
  • XML:

    
    确认患者无脉搏和呼吸暂停。
    开始或继续CPR。除除颤期间和/或因转移患者而中断10秒外,CPR应始终持续进行。
    确保气道通畅并开始使用BVM。提供初始BLS气道管理,包括口咽或鼻咽气道。
    如果可用,应用AED或SAED。如果AED已经到位,等待当前电击序列完成,切换到另一个AED或手动监护仪-如果与新装置兼容,可以使用先前应用的补丁。
    遵循AED/SAED设备提供的提示。
    利用ALS,或启动向ALS的及时运输(ALS拦截或医院,如果更近)。如果ALS不可用,应在现场进行不超过3次电击。不应在移动的救护车上进行除颤。
    尽快通知接收医院。
    如果尚未应用AED/SAED,则在CPR至少5个周期(约2分钟)后,使用手动监护仪快速查看并除颤PRN。在适当的电击顺序之间使用肢体导线和衬垫。
    获得血管通路。
    固定固定气道。如果BLS气道足以维持胸部上升,则继续,直到有额外的时间或资源可用。如果无法插管,则继续使用BLS气道辅助装置或使用备用气道装置。

    在转移患者、将患者移入和移出救护车或其他时间,拆除气囊阀装置 当气囊阀装置可能移动装置时。

    在患者移动后重新评估气道通畅性。 按照以下特定心律失常/心律失常协议中列出的药物服用。 如果无法获得IV/IO通道,可通过ETT在以下条件下使用肾上腺素、阿托品和利多卡因: 直接在线医疗控制。
    PHP5 启用XML/XSL


    想法?任何明显的情况在我看来,$\u GET['xsl']是空的

    您的xsl中有一个错误。当您将它加载到
    XSLTProcessor
    对象中时,它会失败。因此,您无法将其应用于xml。

    查看此错误: 警告:XSLTProcessor::importStylesheet()[XSLTProcessor.importStylesheet]:编译错误:文件/protocols.xsl第18行/transform.php中的元素模板位于第24行

    在第18行,您有:

    //第18行


    $sectionNumber在哪里定义?PHP看不到它。

    一种可能是XSL处理器确实在抱怨
    没有被声明为实体。尝试将doctype更改为

    <?xml version="1.0" encoding="UTF-8"?>
    <page type="Protocols">
        <section id="3" title="Adult Cardiac Life Support">
            <protocol id="0" title="Cardiac Arrest - General Procedures">
                <start level="All Levels"/>
                    <step>Verify patient is pulseless and apneic.</step>
                    <step>Initiate or continue CPR.  CPR is to be continued at all times, except during defibrillation and /or interruptions &lt; 10 sec for patient transfer.</step>
                    <step>Assure airway patency and begin use of BVM.  Provide initial BLS airway management, including Oropharyngeal or Nasopharyngeal Airway.</step>
                    <step>Apply AED or SAED if available.  If AED already in place, wait until current shock sequence completion to switch to another AED or manual monitor – may use previously applied patches if compatible with new unit.</step>
                    <step>Follow prompts provided by AED/SAED device.</step>
                    <step>Utilize ALS, or initiate timely transport toward ALS (ALS intercept or hospital if closer).  If ALS not available, no more than 3 shocks should be delivered at the scene.  Defibrillation should not be performed in a moving ambulance.</step>
                    <step>Advise receiving hospital ASAP.</step>
                <stop level="EMT"/>
                <start level="EMT-I, CC &amp; P"/>
                    <step>If AED/SAED not already applied, quick look using manual monitor and defibrillate PRN after CPR of at least 5 cycles (about 2 minutes).  Apply limb leads and pads in between shock sequences as appropriate.</step>
                    <step>Obtain vascular access.</step>
                    <step>Secure definitive airway.  If BLS airway is sufficient to maintain chest rise, continue until additional time or resources are available.  If unable to intubate, continue use of BLS airway adjuncts or use alternate airway device.<br/><br/>emove Bag Valve device whenever transferring patient, moving patient in and out of Ambulance, or other times 
    when Bag Valve device may dislodge the device.<br/><br/>Reassess airway patency after any movement of patient.</step>
                <stop level="EMT-I" />
                <start level="EMT-CC &amp; P"/>
                    <step>Give medications as listed in the following specific arrhythmia / dysrhythmia protocols. 
    </step>
                    <note title="NOTE">Should IV/IO access not be available, Epinephrine, Atropine, and Lidocaine may be administered via ETT under 
    direct, on-line Medical Control.</note>
            </protocol></section></page>
    

    我也遇到过同样的问题,这似乎是XSLTProcessor中的一个问题。如果使用参数调用XSL,请在`

    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp '&#160;'> ] >
    
    这里也有同样的问题。 我通过在“xsl:template”节点中包含“xsl:if”节点来解决这个问题。 在你的情况下,它会给出:

    <template match="/"><xsl:parameter name="whatever"/">
    
    //第18行
    //第22行
    (.) 
    
    样式表无效XSLT 1.0:模式中不能有变量/参数引用

    您可以在XSLT2.0模式中使用变量/参数引用


    正如所建议的,您需要在内容模板中通过该测试。

    事实并非如此。当我用“protocols.xsl”和“protocols.xsl”替换变量时,我得到了相同的错误,
    $xsldoc->load($\u GET['xsl']..xsl')返回?请检查我的答案,以了解您问题的确切解释。我不这么认为。在浏览器中直接查看xsl文件时,我没有收到任何错误,我可以使用Javascript获取xsl来转换xml(不会在所有客户端都起作用,例如PHP尝试)。在从PHP$XSL->setParameter(“”,'sectionNumber',$\u GET['sectionNumber'])传入的XSL中设置sectionNumber参数;。通过调用$sectionNumberWell可以在XSL文档的其他地方访问它,无论如何,它没有看到这个参数。这就是为什么在第24行的/transform.php中显示错误:Undefined variable in/transform.php我同意你的观点,尽管我认为这是由于样式表由于任何原因没有被导入的结果。我能够在我的计算机上重现这个问题。我只是没有传递任何变量/参数。未导入样式表,因为$variables被解析为null,因此它是样式表中的一个错误。它不可能是错误,XSL使用Javascript验证并显示良好。。。我尝试在XSL中手动设置变量(并且没有通过PHP传递任何变量),但我得到了相同的错误。很好!事实上已经是了,我只是把它剪下来贴在这里。下次我不会这么做了…如果不是这样,我怀疑是个bug。我将xsl逐字加载到Oxygen/XML中,唯一的问题是缺少实体。修复后,它通过了良好的格式测试。我指的是XSLTProcessor.importStyleSheet()中的一个bug,当然了。谢谢检查。是的,这与XSL在PHP中的处理方式有关。我认为它不喜欢属性比较测试(即:node[@id=$parameter])几年前,我们的开发人员在match属性中使用允许的变量的libxml版本,但QA使用的是一个失败的新环境。试着远程找出那个答案很有趣。
    
    <?xml version="1.0" encoding="UTF-8"?>
    <page type="Protocols">
        <section id="3" title="Adult Cardiac Life Support">
            <protocol id="0" title="Cardiac Arrest - General Procedures">
                <start level="All Levels"/>
                    <step>Verify patient is pulseless and apneic.</step>
                    <step>Initiate or continue CPR.  CPR is to be continued at all times, except during defibrillation and /or interruptions &lt; 10 sec for patient transfer.</step>
                    <step>Assure airway patency and begin use of BVM.  Provide initial BLS airway management, including Oropharyngeal or Nasopharyngeal Airway.</step>
                    <step>Apply AED or SAED if available.  If AED already in place, wait until current shock sequence completion to switch to another AED or manual monitor – may use previously applied patches if compatible with new unit.</step>
                    <step>Follow prompts provided by AED/SAED device.</step>
                    <step>Utilize ALS, or initiate timely transport toward ALS (ALS intercept or hospital if closer).  If ALS not available, no more than 3 shocks should be delivered at the scene.  Defibrillation should not be performed in a moving ambulance.</step>
                    <step>Advise receiving hospital ASAP.</step>
                <stop level="EMT"/>
                <start level="EMT-I, CC &amp; P"/>
                    <step>If AED/SAED not already applied, quick look using manual monitor and defibrillate PRN after CPR of at least 5 cycles (about 2 minutes).  Apply limb leads and pads in between shock sequences as appropriate.</step>
                    <step>Obtain vascular access.</step>
                    <step>Secure definitive airway.  If BLS airway is sufficient to maintain chest rise, continue until additional time or resources are available.  If unable to intubate, continue use of BLS airway adjuncts or use alternate airway device.<br/><br/>emove Bag Valve device whenever transferring patient, moving patient in and out of Ambulance, or other times 
    when Bag Valve device may dislodge the device.<br/><br/>Reassess airway patency after any movement of patient.</step>
                <stop level="EMT-I" />
                <start level="EMT-CC &amp; P"/>
                    <step>Give medications as listed in the following specific arrhythmia / dysrhythmia protocols. 
    </step>
                    <note title="NOTE">Should IV/IO access not be available, Epinephrine, Atropine, and Lidocaine may be administered via ETT under 
    direct, on-line Medical Control.</note>
            </protocol></section></page>
    
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp '&#160;'> ] >
    
    <template match="/"><xsl:parameter name="whatever"/">
    
    <xsl:template match="page/section"> // LINE 18
        <xsl:if test="@id=$sectionNumber">
            <xsl:apply-templates select="protocol[@id=$protocolNumber]"/>
        </xsl:if>
    </xsl:template>
    
    <xsl:template match="protocol"> // LINE 22
        <xsl:if test="@id=$protocolNumber">
            <h4>(<xsl:value-of select="$sectionNumber"/>.<xsl:value-of select="@id"/>)&nbsp;<xsl:value-of select="@title"/></h4>
            <!-- Applies templates to all child elements -->
            <ol><xsl:apply-templates/></ol>
        </xsl:if>
    </xsl:template>