开发者

Default Namespace Issue during translation using xsl

开发者 https://www.devze.com 2023-03-15 01:29 出处:网络
<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"> <xsl:output omit-xml-declaration=\"no\" indent=\"yes\" />
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="no" indent="yes" />
    <xsl:strip-space elements="*" />

<!--      <xsl:template match="//edx:rule" xmlns:edx="http://www.cisco.com/BRL">
   <xsl:apply-templates />
  </xsl:template>  -->
    <xsl:template match="*">
        <xsl:element name="{local-name(.)}">
            <xsl:apply-templates select="@* | node()" />
        </xsl:element>
    </xsl:template> 
    <xsl:template match="lhs" name="lhsTemplate">
        <xsl:element name="lhs">
            <xsl:choose>
                <xsl:when test="incident != ''">
                    <xsl:for-each select="incident">
                        <xsl:element name="freeForm">
                            <xsl:element name="text">
                                <xsl:apply-templates select="." />
                                <!-- <xsl:call-template name = "incidentTemplate"/> -->
                            </xsl:element>
                        </xsl:element>
                    </xsl:for-each>
                </xsl:when>
                <xsl:when test="evaluate != ''">
                    <xsl:for-each select="evaluate">
                        <xsl:element name="freeForm">
                            <xsl:element name="text">
                                <xsl:apply-templates select="." />
                                <!-- <xsl:call-template name = "evaluateTemplate"/> -->
                            </xsl:element>
                        </xsl:element>
                    </xsl:for-each>
                </xsl:when>         
           <xsl:when test="ruleReference != ''">
                    <xsl:value-of select="ruleReference" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text> no elements encountered in lhs block</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:element>
    </xsl:template>
    <xsl:template match="rhs" name="rhsTemplate">
        <xsl:element name="rhs">
            <xsl:choose>
          <xsl:when test="modify != ''">
                        <xsl:for-each select="modify">
                        <xsl:element name="freeForm">
                        <xsl:element name="text">
                        <xsl:apply-templates select="." />
                        </xsl:element>
                        </xsl:element>
                        </xsl:for-each> 
                </xsl:when> 
                <xsl:when test="tryCatchBlock/try/callFunction != ''">
                        <xsl:for-each select="tryCatchBlock/try/callFunction">
                        <xsl:element name="freeForm">
                        <xsl:element name="text">
                        <xsl:apply-templates select="." />
                        <xsl:text>;</xsl:text>
                        </xsl:element>
                        </xsl:element>
                        </xsl:for-each>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text> no elements encountered in Try block</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:element>
    </xsl:template>
    <!-- FIELE VALUES TEMPLATE  -->
    <xsl:template match="fieldValues" name="fieldValuesTemplate">
    <xsl:for-each select="fieldValue" >
<!-- <xsl:if test="field!=''">
     <xsl:value-of select="field"/>
    <xsl:text>=</xsl:text> 
    </xsl:if> -->
     <xsl:choose>
     <xsl:when test="value/literal !=''">
     <xsl:value-of select="value/literal"/>
     </xsl:when>
     <xsl:when test="value/formula !=''">
     <xsl:apply-templates select="value/formula"/>
     </xsl:when>
     <xsl:when test="value/callMethodOnBoundVariable != ''">
     <xsl:apply-templates select="value/callMethodOnBoundVariable"/>
     </xsl:when>
     <xsl:when test="value/callApi !=''">
     <xsl:apply-templates select="."/>
     </xsl:when>
     <xsl:when test="value/boundVariable !=''">
     <xsl:value-of select="value/boundVariable"/>
     </xsl:when>
     <xsl:when test="value/enum != ''">
     <xsl:value-of select="value/enum"/>
     </xsl:when>
     <xsl:when test="value/content != ''">
     <xsl:value-of select="value/content"/>
     </xsl:when>
     <xsl:otherwise>
     <xsl:text>No values encountered inside field</xsl:text>
     </xsl:otherwise>
     </xsl:choose>
    <xsl:if test="position() != last()">
    <xsl:text>,</xsl:text>
    </xsl:if>
    </xsl:for-each> 
    </xsl:template>
        <!-- INSERT LOGICAL TEMPLATE -->
    <xsl:template match="insertLogical" name="insertLogicalTemplate">
    <xsl:value-of select="factType"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="boundName"/>
    <xsl:text> = new </xsl:text>
    <xsl:value-of select="factType"/>
    <xsl:text>(</xsl:text>
    <xsl:if test="fieldValues!=''">
    <xsl:apply-templates select="fieldValues"/>
    </xsl:if>
     <xsl:text>);</xsl:text>
     <xsl:text>insertLogical</xsl:text>
     <xsl:text>(</xsl:text>
     <xsl:value-of select="boundName"/>
     <xsl:text>);</xsl:text>
    </xsl:template>
    <!-- END OF THE INSERT LOGICAL TEMPLATE  -->
    <!-- ASSERT MODIFY TEMPLATE -->
    <xsl:template match="modify" name="modifyTemplate">
    <xsl:text>modify</xsl:text>
    <xsl:text>( </xsl:text>
    <xsl:value-of select="variable"/>
    <xsl:text> ){ </xsl:text>
    <xsl:if test="fieldValues!=''"> 
   <xsl:apply-templates select="fieldValues"/>
    </xsl:if>
     <xsl:text> };</xsl:text>
    </xsl:template>
    <!-- END OF THE MODIFY TEMPLATE  -->
    <!-- RETRACT TEMPLATE -->
    <xsl:template match="retract" name="retractTemplate">
        <xsl:text>retract(</xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>);</xsl:text>
    </xsl:template>
   <!-- END OF THE RETRACT TEMPLATE -->
<!-- start leftOperandTemplate -->
    <xsl:template match="leftOperand" name="leftOperandTemplate">
        <xsl:choose>
            <xsl:when test="field/fieldName != ''">
                <xsl:value-of select="field/fieldName" />
            </xsl:when>
            <xsl:when test="boundVariable/variableName != ''">
                <xsl:value-of select="boundVariable/variableName" />
            </xsl:when>
            <xsl:when test="expression != ''">
                <xsl:apply-templates select="expression" /> <!-- TO DO -->
            </xsl:when>
            <xsl:when test="literal != ''">
                <xsl:value-of select="literal" />
            </xsl:when>
            <xsl:when test="value/content != ''">
                <xsl:value-of select="value/content" />
            </xsl:when>
            <xsl:when test="callFunction != ''">
                <xsl:apply-templates select="callFunction" />
            </xsl:when>
            <xsl:when test="formula != ''">
                <xsl:apply-templates select="formula" />
            </xsl:when>
            <xsl:when test="callApi != ''">
                <xsl:apply-templates select="callApi" />
            </xsl:when>
            <xsl:when test="callMethodOnBoundVariable != ''">
                <xsl:apply-templates select="callMethodOnBoundVariable" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>No left operands found!</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <!-- end leftOperandTemplate -->
    <!-- start Right operand template -->
    <xsl:template match="rightOperand" name="rightOperandTemplate">
        <xsl:choose>
            <xsl:when test="boundVariable/variableName != ''">
                <xsl:value-of select="boundVariable/variableName" />
            </xsl:when>
            <xsl:when test="configurableVariable/variableName != ''">
                <xsl:value-of select="configurableVariable/variableName" />
            </xsl:when>
            <xsl:when test="literal != ''">
                <xsl:value-of select="literal" />
            </xsl:when>
            <xsl:when test="value/content != ''">
                <xsl:value-of select="value/content" />
            </xsl:when>
            <xsl:when test="callFunction != ''">
                <xsl:apply-templates select="callFunction" />
            </xsl:when>
            <xsl:when test="formula != ''">
                <xsl:apply-templates select="formula" />
            </xsl:when>
            <xsl:when test="callApi != ''">
                <xsl:apply-templates select="callApi" />
            </xsl:when>
            <xsl:when test="callMethodOnBoundVariable != ''">
                <xsl:apply-templates select="callMethodOnBoundVariable" />
            </xsl:when>
            <xsl:when test="expression != ''">
                <xsl:apply-templates select="expression" /> <!-- TO DO -->
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>No right operands found!</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!-- end Right operand template -->

    <!-- start Comparison operator template -->
    <xsl:template match=" operator | comparisonOperator" name="compareOperatorTemplate">

        <xsl:choose>
            <xsl:when test=".='gt'">
                <xsl:value-of select="' &gt; '"
                    disable-output-escaping="yes" />
            </xsl:when>
            <xsl:when test=". = 'lt'">
                <xsl:value-of select="' &lt; '"
                    disable-output-escaping="yes" />
            </xsl:when>
            <xsl:when test=".='eq'">
                <xsl:value-of select="' == '" disable-output-escaping="yes" />
            </xsl:when>
            <xsl:when test=". = 'ne'">
                <xsl:value-of select="' != '" disable-output-escaping="yes" />
            </xsl:when>
            <xsl:when test=". = 'lt or eq'">
                <xsl:value-of select="' &lt;= '"
                    disable-output-escaping="yes" />
            </xsl:when>
            <xsl:when test=". = 'gt or eq'">
                <xsl:value-of select="' &gt;= '"
                    disable-output-escaping="yes" />
            </xsl:when>
            <xsl:when test=". = 'matches'">
                <xsl:value-of select="' matches '" />
            </xsl:when>
            <xsl:when test=". = 'not matches'">
                <xsl:value-of select="' not matches '" />
            </xsl:when>

            <xsl:when test=". = 'contains'">
                <xsl:value-of select="' contains '" />
            </xsl:when>
            <xsl:when test=". = 'not contains'">
                <xsl:value-of select="' not contains '" />
            </xsl:when>
            <xsl:when test=". = 'memberOf'">
                <xsl:value-of select="' memberOf '" />
            </xsl:when>
            <xsl:when test=". = 'not memberOf'">
                <xsl:value-of select="' not memberOf '" />
            </xsl:when>
            <xsl:when test=". = 'sounds like'">
                <xsl:value-of select="' sounds like '" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>No operator found</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <!-- End Comparison operator template -->
    <xsl:template match="evaluate" name="evaluateTemplate">
        <xsl:text disable-output-escaping="yes">eval(</xsl:text>
        <xsl:if test=". !=''">
            <xsl:apply-templates select="leftOperand" />
            <xsl:if test="comparisonOperator !=''">
                <xsl:apply-templates select="comparisonOperator" />
            </xsl:if>
            <xsl:apply-templates select="rightOperand" />
        </xsl:if>
        <xsl:text>)</xsl:text>
    </xsl:template>
    <!-- END EVALUATE TEMPLATE -->
    <!-- start CALL FUNCTION TEMPLATE -->
    <xsl:template match="callFunction" name="callFunctionTemplate">
        <xsl:if test=". !=''">
            <xsl:if test="returnType!='' and returnTypeBoundName !='' ">
                <xsl:value-of select="returnType" />
                <xsl:text> </xsl:text>
                <xsl:value-of select="returnTypeBoundName" />
                <xsl:text>=</xsl:text>
            </xsl:if>
            <xsl:if test="functionName!=''">
                <xsl:value-of select="functionName" />
                <xsl:text>(</xsl:text>
                <!-- <xsl:apply-templates select="args"/> -->
                <xsl:call-template name="argsTemplate" />
            </xsl:if>
            <xsl:text>)</xsl:text>
        </xsl:if>
    </xsl:template>
    <!-- END OF THE CALL FUNCTION TEMPLATE -->

    <!-- START ARGS TEMPLATE -->
    <xsl:template match="args" name="argsTemplate">
        <xsl:if test="args/arg != ''">
            <xsl:for-each select="args/arg">
                <xsl:choose>
                    <xsl:when test="callMethodOnBoundVariable != ''">
                        <xsl:apply-templates select="callMethodOnBoundVariable" />
                    </xsl:when>
                    <xsl:when test="callApi != ''">
                        <xsl:apply-templates select="callApi" />
                    </xsl:when>
                    <xsl:when test="value != ''">
                        <xsl:value-of select="value/content" />
                    </xsl:when>
                    <xsl:when test="literal != ''">
                        <xsl:value-of select="." />
                    </xsl:when>
                    <xsl:when test="boundVariable != ''">
                        <xsl:value-of select="boundVariable/variableName" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:text>No Args</xsl:text>
 开发者_如何学Go                   </xsl:otherwise>
                </xsl:choose>
                <xsl:if test="position() != last()">
                    <xsl:text>,</xsl:text>
                </xsl:if>
            </xsl:for-each>
        </xsl:if>
    </xsl:template>
    <!-- END OF THE ARGS TEMPLATE -->

    <!-- START of the Call Method on Bound Variable function -->
    <xsl:template match="callMethodOnBoundVariable" name="callMethodOnBoundVariableTemplate">
        <xsl:value-of select="boundVariableName" />
        <xsl:text>.</xsl:text>
        <xsl:value-of select="methodName" />
        <xsl:text>(</xsl:text>
        <!-- <xsl:value-of select="params/param/boundVariable" /> -->
        <xsl:call-template name="paramsTemplate" />
        <xsl:text>)</xsl:text>
    </xsl:template>
    <!-- End of the Call Method on Bound Variable function -->

    <!-- START CALL API TEMPLATE -->
    <xsl:template match="callApi" name="callApiTemplate">
        <!-- <xsl:if test="returnType != 'void'"> <xsl:value-of select="returnType 
            " /> <xsl:text> </xsl:text> </xsl:if> -->
        <xsl:value-of select="boundVaribleName" />
        <xsl:if test="boundVaribleName[.!='']">
            <xsl:text>=</xsl:text>
        </xsl:if>

        <xsl:value-of select="serviceVariableName" />
        <xsl:text>.</xsl:text>
        <xsl:value-of select="methodName" />
        <xsl:text>(</xsl:text>
        <xsl:call-template name="paramsTemplate" />
        <xsl:text>)</xsl:text>
    </xsl:template>
    <!-- END call API TEMPLATE -->

    <!-- FORMULA TEMPLATE -->
    <xsl:template match="formula" name="formulaTemplate">
        <xsl:if test="'leftOperand'">
            <xsl:call-template name="formulaWithoutPeranthesisTemplate" />
        </xsl:if>
        <xsl:if test="'peranthesis'">
            <xsl:call-template name="formulaWithPeranthesisTemplate" />
        </xsl:if>

    </xsl:template>
    <!-- END OF THE FORMULA TEMPLATE -->

    <!-- start Formula without peranthesis template -->
    <xsl:template match="formulaWithoutPeranthesis" name="formulaWithoutPeranthesisTemplate">
        <xsl:if test="leftOperand">
            <xsl:apply-templates select="leftOperand" />
        </xsl:if>
        <xsl:if test="arithmeticOperator">
            <xsl:apply-templates select="arithmeticOperator" />
        </xsl:if>
        <xsl:if test="rightOperand">
            <xsl:apply-templates select="rightOperand" />
        </xsl:if>
    </xsl:template>
    <!-- End Formula without peranthesis template -->

    <!-- start Formula withparenthesis template -->
    <xsl:template match="formulaWithPeranthesis" name="formulaWithPeranthesisTemplate">
        <xsl:if test="peranthesis != ''">
            <xsl:text>(</xsl:text>
            <xsl:if test="peranthesis/leftOperand !=''">
                <xsl:apply-templates select="peranthesis/leftOperand" />
            </xsl:if>
            <xsl:if test="peranthesis/arithmeticOperator">
                <xsl:apply-templates select="peranthesis/arithmeticOperator" />
            </xsl:if>
            <xsl:if test="peranthesis/rightOperand">
                <xsl:apply-templates select="peranthesis/rightOperand" />
            </xsl:if>
            <xsl:text>)</xsl:text>
        </xsl:if>
    </xsl:template>
    <!-- END Formula with parenthesis template -->
    <!-- START ARITHMETIC OPERATOR -->
    <xsl:template match="arithmeticOperator" name="arithmeticOperatorTemplate">
        <xsl:choose>
            <xsl:when test="'+'">
                <xsl:value-of select=" . " />
            </xsl:when>
            <xsl:when test="'-'">
                <xsl:value-of select=" . " />
            </xsl:when>
            <xsl:when test="'*'">
                <xsl:value-of select=" . " />
            </xsl:when>
            <xsl:when test="'/'">
                <xsl:value-of select=" . " />
            </xsl:when>
            <xsl:when test="'%'">
                <xsl:value-of select=" . " />
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>Not a valid airthmetic operator</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <!-- END ARITHMETIC OPERATOR -->


    <!-- START OF THE PARAMS TEMPLATE -->
    <xsl:template match="params" name="paramsTemplate">
        <xsl:if test="params/param != ''">
            <xsl:for-each select="params/param">
                <xsl:choose>
                    <xsl:when test="callMethodOnBoundVariable != ''">
                        <xsl:apply-templates select="callMethodOnBoundVariable" />
                    </xsl:when>
                    <xsl:when test="formula != ''">
                        <xsl:apply-templates select="formula" />
                    </xsl:when>
                    <xsl:when test="callApi != ''">
                        <xsl:apply-templates select="callApi" />
                    </xsl:when>
                    <xsl:when test="value != ''">
                        <xsl:value-of select="value/content" />
                    </xsl:when>
                    <xsl:when test="literal != ''">
                        <xsl:text>"</xsl:text>
                        <xsl:value-of select="." />
                        <xsl:text>"</xsl:text>
                    </xsl:when>
                    <xsl:when test="boundVariable != ''">
                        <xsl:value-of select="boundVariable" />
                    </xsl:when>
                    <xsl:when test="enum != ''">
                        <xsl:value-of select="enum" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:text>No Param</xsl:text>
                    </xsl:otherwise>
                </xsl:choose>
                <xsl:if test="position() != last()">
                    <xsl:text>,</xsl:text>
                </xsl:if>
            </xsl:for-each>
        </xsl:if>
    </xsl:template>
    <!-- END OF THE PARAMS TEMPLATE -->
    <!--START COMPOSITE PATTERN TEMPLATE -->
    <xsl:template match='compositePattern' name="compositePatternTemplate">
        <xsl:if test="type != ''">
            <xsl:value-of select="type" />
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:apply-templates select="patterns" />
    </xsl:template>
    <!-- END COMPOSITE PATTERN TEMPLATE -->
        <xsl:template name="tagAndContentRemovalTemplate"
        match=" nuggetVersion |nuggetId | ruleVersion | notes|ruleId | nuggetName | application | brlVersion | modelVersion | notes|declaration|preprocess " />

        <xsl:template name="tagRemovalTemplate"
        match="  ruleSection | blocks | block |actions | fieldRestriction  | declaration | preprocess | tryCatchBlock |constraintList  ">
        <xsl:apply-templates />
        <!-- set field and expression TBD -->
    </xsl:template>
</xsl:stylesheet>

The Input file looks like below.

<?xml version="1.0" encoding="UTF-8"?>
<rule >
    <name>IC-86</name>
    <ruleId>1001</ruleId>
    <ruleVersion>1.0</ruleVersion>
    <nuggetId>1122</nuggetId>
    <brlVersion>1.0</brlVersion>
    <modelVersion>1.0</modelVersion>
    <attributes>
        <attribute>
            <attributeName>agenda-group</attributeName>
            <value>commonATSP</value>
        </attribute>
        </attributes>
    <notes>Some text description about the rule, like what exactly it does...</notes>
    <declaration />
    <preprocess />
    <ruleSection>
        <blocks>
            <block order="0">
                <lhs>

            <evaluate>
            <leftOperand>
                <boundVariable>
                    <variableName>$count</variableName>
                    <classType>Integer</classType>
                    <genericType>Number</genericType>
                </boundVariable>
            </leftOperand>
            <comparisonOperator>gt</comparisonOperator>
            <rightOperand>
                <literal>10</literal>
            </rightOperand>
                 </evaluate>    
                </lhs>

                <rhs>
<modify>
                        <fieldValues>
                            <fieldValue>
                                <field>name</field>
                                <value>
                                    <literal>$imageVersion</literal>
                                </value>
                                <nature>1</nature>
                                <type>String</type>
                            </fieldValue>
                            <fieldValue>
                                <field>value</field>
                                <value>
                                    <callMethodOnBoundVariable>
                                        <params>
                                            <param>
                                                <value>
                                        <content>0</content>
                                        <classType>int</classType>
                                    <genericType>Numeric</genericType>
                                                </value>
                                            </param>
                                        </params>
                            <boundVariableName>$attributes</boundVariableName>
                                    <methodName>get</methodName>
                                    <returnType>String</returnType>
                                    </callMethodOnBoundVariable>
                                </value>
                                <nature>4</nature>
                                <type>String</type>
                            </fieldValue>
                            <fieldValue>
                                <field>type</field>
                                <value>
                                    <literal>imageName</literal>
                                </value>
                                <nature>1</nature>
                                <type>String</type>
                            </fieldValue>
                        </fieldValues>
                        <variable>$attribute</variable>
                    </modify>  
                </rhs>
            </block>
        </blocks>
    </ruleSection>
</rule>

I am facing an issue with my default namespace. I have a file with the root tag as below:

<rule xmlns="http://www.max.com/BRL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.max.com/BRL ../BRLV4.xsd ">

If I remove the namespaced <rule> as seen in the above input XML, then the translation works. Otherwise, it doesn't work. That is, if I try the translation without the default namespace then I am getting the required output as below. But I need the same output when I get the XML file with the default namespace on the root tag.

    <?xml version="1.0" encoding="UTF-8"?>
<rule>
<name>IC-86</name>
<attributes>
<attribute>
<attributeName>agenda-group</attributeName>
<value>commonATSP</value>
</attribute>
</attributes>
<lhs>
<freeForm>
<text>eval($count > 10)</text>
</freeForm>
</lhs>
<rhs>
<freeForm>
<text>modify( $attribute ){ $imageVersion,$attributes.get(0),imageName };</text>
</freeForm>
</rhs>
</rule>


The default namespace in the XML document must be declared in the XSLT. For example, use the prefix 'brl'.

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:brl="http://www.max.com/BRL">

Then use the brl prefix when referring to the tag names. For example,

<xsl:template match="brl:lhs" name="lhsTemplate">
...
<xsl:when test="brl:incident != ''">
<xsl:for-each select="brl:incident">

If the XML document may or may not have a namespace, see my article "Stay on the XPath: Tip 5: Handling XPath select expressions that fail to match documents with a default namespace" on IBM developerWorks.


Basically, you need your stylesheet to work whether all the elements are in no namespace, or in the BRL namespace. This is an odd requirement, and the ideal solution would be to tell your upstream data provider to be consistent about using the namespace.

But if you don't have that option, you have a few others.

1) Declare a prefix for the BRL namespace in your stylesheet, and use it to match elements in that namespace or in no namespace:

<xsl:stylesheet ... xmlns:BRL="http://www.max.com/BRL">
  ...
  <xsl:template match="lhs | BRL:lhs">

...

2) Make all your matches and selects use local-name():

  <xsl:template match="*[local-name()='lhs']">...

...

(Yuck!)

3) In XSLT 2.0, you can use the wildcard for namespaces:

  <xsl:template match="*:lhs">
  ...
  <xsl:when test="*:field/*:fieldName != ''">

But again, these three are all working around a problem in the source data. They are compensating for someone not using namespaces correctly, and thus enabling them to keep on doing the same. If the schema says the input document's elements should be in the "http://www.max.com/BRL" namespace, then you should assume that they are in that namespace (whether that's the default namespace is immaterial to you), so you should always be using a namespace prefix when matching or selecting those elements with XPath.

0

精彩评论

暂无评论...
验证码 换一张
取 消