Visual Studio 2010 (XslTransformException) with xalan:nodeset() function

Proposed Visual Studio 2010 (XslTransformException) with xalan:nodeset() function

  • 19 เมษายน 2555 12:04
     
      มีโค้ด

    Hello,

    I´m new to this forums and not realy a developer. So I have my problems with Visual Studio 2010 and xsl and I hope to find help with you. 

    I´m working with Visual Studio 2010 and try to debug an xsl file.
    The debugger shows an error in a row where I try to convert an variable into a nodeset

    <xsl:variable name="smcCollectedObjectsNodeset" select="xalan:nodeset($smcCollectedObjects)"/>

    Here the debugger stops with XslTransformException "Cannot find the script or external object that implements prefix '
    http://xml.apache.org/xalan'

    I defined the xalan namespace in the header of the xml file as you can see in the text.

    <xsl:stylesheet version="1.0" xmlns:xsl="kttp://www.w3.org/1999/XSL/Transform" xmlnslm="http://www.plmxml.org/Schemas/PLMXMLSchema" xmlns:xalan="http://xml.apache.org/xalan" xmlns:lxslt="http://www.apache.org/xslt" xmlns:redirect="org.apache.xalan.lib.Redirect">
    <xsl:variable name="reportHeader" select="'Mengenstueckliste fuer Maschinenteile (M)'"/>

    Does someone know how to solve this problem with visual Studio 2010?

    Below you can find the content of the xsl and xml files.

    <?xml version="1.0"?>
    
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema" xmlns:xalan="http://xml.apache.org/xalan" xmlns:lxslt="http://www.apache.org/xslt" xmlns:redirect="org.apache.xalan.lib.Redirect">
      <xsl:variable name="reportHeader" select="'Mengenstueckliste fuer Maschinenteile (M)'"/>
    	<xsl:key name="smcProductRevisionKey" match="plm:ProductRevision" use="@id"/>
    	<xsl:key name="smcProductKey" match="plm:Product" use="@id"/>
    	<xsl:key name="smcAssociatedAttachmentKey" match="plm:AssociatedAttachment" use="@id"/>
    	<xsl:key name="smcFormKey" match="plm:Form" use="@id"/>
    	<xsl:output method="html" />
    	<xsl:template match="/">
        <html>
          <head>
            <title>
              <xsl:value-of select="$reportHeader"/>
            </title>
            <style type="text/css">
              table
              {
                border-collapse: collapse;
                border-spacing: 0pt;
                width: 100%;
                empty-cells: show;
                <!-- Farbe des Zellrahmens -->
                border-color:#000000;
              }
              th
              {
              border-style:solid;
              border-width:0.2pt;
              border-color: #000000;
              background-color: #99CCFF;
              font-family: Arial;
              }
              td
              {
              border-style:solid;
              border-width:0.2pt;
              border-color: #000000;
              font-family: Arial;
              color: #000000;
              }
            </style>
          </head>
          <body bgcolor="FFFFFF" link="#0000FF" vlink="#660066">
            <br/>
            <p>
              <table width="100%">
                <tr bgcolor="#FFCC66">
                  <td>
                    <font size="4">
                      <xsl:value-of select="$reportHeader"/>
                    </font>
                  </td>
                </tr>                   
              </table>
            </p>
            <xsl:variable name="smcCollectedObjects">
              <smcItemRevisions>
                <xsl:for-each select="//plm:ProductView/plm:Occurrence">
                  <xsl:variable name="smcProductRevisionElement" select="key('smcProductRevisionKey', substring-after(@instancedRef,'#'))"/>
                  <xsl:variable name="smcProductElementID" select="substring-after($smcProductRevisionElement/@masterRef,'#')"/>
                  <xsl:variable name="smcProductElement" select="key('smcProductKey', $smcProductElementID)" />
                  <xsl:call-template name="loopAssociatedReferences">
                    <xsl:with-param name="associatedReferences" select="@associatedAttachmentRefs"/>
                    <xsl:with-param name="itemRevName" select="$smcProductRevisionElement/@name"/>
                    <xsl:with-param name="itemRevID" select="$smcProductRevisionElement/@revision"/>
                    <xsl:with-param name="itemRevItemID" select="$smcProductElement/@productId"/>
                  </xsl:call-template>
                </xsl:for-each>
              </smcItemRevisions>
            </xsl:variable>
            <xsl:variable name="smcCollectedObjectsNodeset" select="xalan:nodeset($smcCollectedObjects)"/>
            <table>
              <tr align="left">
                <th>Name</th>
                <th>Artikelnummer</th>
                <th>Revision</th>
                <th>Anzahl</th>
              </tr>
            </table>
          </body>
        </html>
    	</xsl:template>
    	<!-- ************************************************************************** -->
    	<xsl:template name="loopAssociatedReferences">
        <!-- ************************************************************************** -->
        <xsl:param name="associatedReferences"/>	
    	<xsl:param name="itemRevName"/>
    	<xsl:param name="itemRevID"/>
    	<xsl:param name="itemRevItemID"/>
    		


    <xsl:if test="$associatedReferences!=''"> <xsl:choose> <!-- Check if associatedReferences contains multiple entries --> <!-- If yes, then go ahead --> <xsl:when test="contains($associatedReferences,' ')"> <!-- --> <xsl:call-template name="xxx"> <xsl:with-param name="associatedRefID" select="substring-before($associatedReferences,' ')"/> <xsl:with-param name="itemRevName" select="$itemRevName"/> <xsl:with-param name="itemRevID" select="$itemRevID"/> <xsl:with-param name="itemRevItemID" select="$itemRevItemID"/> </xsl:call-template> <!-- Invoke this template with the adjusted arry of associatedReferences --> <xsl:call-template name="loopAssociatedReferences"> <xsl:with-param name="associatedReferences" select="substring-after($associatedReferences,' ')"/> <xsl:with-param name="itemRevName" select="$itemRevName"/> <xsl:with-param name="itemRevID" select="$itemRevID"/> <xsl:with-param name="itemRevItemID" select="$itemRevItemID"/> </xsl:call-template> </xsl:when> <!-- There is just one entry in associatedReferences --> <xsl:otherwise> <xsl:call-template name="xxx"> <xsl:with-param name="associatedRefID" select="$associatedReferences"/> <xsl:with-param name="itemRevName" select="$itemRevName"/> <xsl:with-param name="itemRevID" select="$itemRevID"/> <xsl:with-param name="itemRevItemID" select="$itemRevItemID"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:if> </xsl:template> <!-- ************************************************************************** --> <xsl:template name="xxx"> <!-- ************************************************************************** --> <xsl:param name="associatedRefID"/> <xsl:param name="itemRevName"/> <xsl:param name="itemRevID"/> <xsl:param name="itemRevItemID"/> <xsl:variable name="associatedAttachmentElement" select="key('smcAssociatedAttachmentKey', substring-after($associatedRefID,'#'))"/> <xsl:if test="$associatedAttachmentElement/@role ='IMAN_master_form'"> <xsl:variable name="formID" select="substring-after($associatedAttachmentElement/@attachmentRef,'#')"/> <xsl:variable name="formElement" select="key('smcFormKey', $formID)"/> <xsl:variable name="smcClassGroup" select="$formElement/plm:UserData/plm:UserValue[@title='SmcClassGroup']/@value"/> <xsl:if test="$smcClassGroup ='X' or $smcClassGroup ='M'"> <vpdgItemRev> <vpdgItemRevName> <xsl:value-of select="$itemRevName"/> </vpdgItemRevName> <vpdgItemRevItemID> <xsl:value-of select="$itemRevItemID"/> </vpdgItemRevItemID> <vpdgItemRevID> <xsl:value-of select="$itemRevID"/> </vpdgItemRevID> <!-- --> <testGroup> <xsl:value-of select="$formElement/plm:UserData/plm:UserValue[@title='SmcClassGroup']/@value"/> </testGroup> </vpdgItemRev> </xsl:if> </xsl:if> </xsl:template> </xsl:stylesheet>
    <?xml version="1.0" encoding="utf-8"?>
    <!-- GENERATED BY: PLM XML SDK 7.0.2.173 -->
    <PLMXML xmlns="http://www.plmxml.org/Schemas/PLMXMLSchema"
     schemaVersion="6" language="en-us" date="2012-04-04" time="12:54:23" author="Teamcenter V8000.3.0.21_20110408.00 - infodba@IMC-528199808(528199808)">
    	<Header id="id1" traverseRootRefs="#id6" transferContext="ConfiguredDataExportDefault"/>
    	<ProductRevision id="id33" name="Testpart Klotz" accessRefs="#id10" subType="smc Revision" masterRef="#id37" revision="B">
    		<UserData id="id34">
    			<UserValue value="2011-09-15T13:38:47" title="last_mod_date"/>
    			<UserValue value="10002598/B-Testpart Klotz" title="object_string"/>
    		</UserData>
    		<AssociatedDataSet id="id35" dataSetRef="#id27" role="IMAN_specification"/>
    		<AssociatedDataSet id="id36" dataSetRef="#id24" role="IMAN_Rendering"/>
    	</ProductRevision>
    	<ProductRevision id="id59" name="Screw_DIN_912_M12x110" accessRefs="#id10" subType="smc Revision" masterRef="#id63" revision="A">
    		<UserData id="id60">
    			<UserValue value="2011-09-27T15:11:03" title="last_mod_date"/>
    			<UserValue value="10002600/A-Screw_DIN_912_M12x110" title="object_string"/>
    		</UserData>
    		<AssociatedDataSet id="id61" dataSetRef="#id53" role="IMAN_specification"/>
    		<AssociatedDataSet id="id62" dataSetRef="#id50" role="IMAN_Rendering"/>
    	</ProductRevision>
    	<ProductRevision id="id68" name="Testassembly Klotz" accessRefs="#id10" subType="smc Revision" masterRef="#id71" revision="D">
    		<UserData id="id69">
    			<UserValue value="2011-09-12T09:49:42" title="last_mod_date"/>
    			<UserValue value="10002599/D-Testassembly Klotz" title="object_string"/>
    		</UserData>
    		<AssociatedDataSet id="id70" dataSetRef="#id9" role="IMAN_specification"/>
    	</ProductRevision>
    	<Product id="id37" name="Testpart Klotz" accessRefs="#id10" subType="smc" productId="10002598"/>
    	<Product id="id63" name="Screw_DIN_912_M12x110" accessRefs="#id10" subType="smc" productId="10002600"/>
    	<Product id="id71" name="Testassembly Klotz" accessRefs="#id10" subType="smc" productId="10002599"/>
    	<ProductDef id="id38">
    		<InstanceGraph id="id39">
    			<UserData id="id40" type="TC Specific Properties">
    				<UserValue value="precise" title="BOM_precision_type"/>
    			</UserData>
    			<ProductInstance id="id41" partRef="#id42" transformRef="id43" sequenceNumber="10" quantity="1">
    				<ApplicationRef version="QrMAAkR0xf7CIA" application="Teamcenter" label="D0EAAQBvxf7CIA"/>
    				<UserData id="id44" type="InstanceNotes">
    					<UserValue value="10002598.par:1" title="AIE_OCC_NAME"/>
    					<UserValue value="Occ Id327" title="SE ObjectID"/>
    				</UserData>
    				<Transform id="id43">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</Transform>
    			</ProductInstance>
    			<ProductInstance id="id64" partRef="#id65" transformRef="id66" sequenceNumber="20" quantity="1">
    				<ApplicationRef version="QvBAAkR0xf7CIA" application="Teamcenter" label="D0KAAQBvxf7CIA"/>
    				<UserData id="id67" type="InstanceNotes">
    					<UserValue value="Screw_DIN_912_M12x110_v9.00.par:1" title="AIE_OCC_NAME"/>
    					<UserValue value="Occ Id352" title="SE ObjectID"/>
    				</UserData>
    				<Transform id="id66">0 0 -1 0 1 0 0 0 0 -1 0 0 0.0256679460279 0.008500000000000001 -0.029499023116 1</Transform>
    			</ProductInstance>
    			<ProductRevisionView id="id42" accessRefs="#id10" revisionRef="#id33">
    				<ApplicationRef version="D0EAAQBvxf7CIA" application="Teamcenter" label="ieCAAQBvxf7CIA/D0EAAQBvxf7CIA/"/>
    			</ProductRevisionView>
    			<ProductRevisionView id="id65" accessRefs="#id10" revisionRef="#id59">
    				<ApplicationRef version="D0KAAQBvxf7CIA" application="Teamcenter" label="DYBAAQBvxf7CIA/D0KAAQBvxf7CIA/"/>
    			</ProductRevisionView>
    		</InstanceGraph>
    	</ProductDef>
    	<RevisionRule id="id2" name="01_Load_as_saved">
    		<Description>Latest Working else Latest Any Status</Description>
    	</RevisionRule>
    	<ProductView id="id4" ruleRefs="#id2" rootRefs="id6" primaryOccurrenceRef="id6">
    		<UserData id="id3" type="TC Specific Properties">
    			<UserValue value="precise" title="BOM_precision_type"/>
    		</UserData>
    		<AssociatedAttachment id="id8" attachmentRef="#id9" role="IMAN_specification"/>
    		<AssociatedAttachment id="id16" attachmentRef="#id17" role="IMAN_master_form"/>
    		<AssociatedAttachment id="id23" attachmentRef="#id24" role="IMAN_Rendering"/>
    		<AssociatedAttachment id="id26" attachmentRef="#id27" role="IMAN_specification"/>
    		<AssociatedAttachment id="id30" attachmentRef="#id31" role="IMAN_master_form"/>
    		<AssociatedAttachment id="id49" attachmentRef="#id50" role="IMAN_Rendering"/>
    		<AssociatedAttachment id="id52" attachmentRef="#id53" role="IMAN_specification"/>
    		<AssociatedAttachment id="id56" attachmentRef="#id57" role="IMAN_master_form"/>
    		<Occurrence id="id6" instancedRef="#id68" associatedAttachmentRefs="#id8 #id16" occurrenceRefs="id20 id46">
    			<UserData id="id7" type="AttributesInContext">
    				<UserValue value="" title="AO_ID"/>
    				<UserValue value="" title="SequenceNumber"/>
    				<UserValue value="" title="OccurrenceName"/>
    				<UserValue value="" title="Quantity"/>
    			</UserData>
    			<Transform id="id5">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</Transform>
    		</Occurrence>
    		<Occurrence id="id20" instancedRef="#id33" instanceRefs="#id41" associatedAttachmentRefs="#id23 #id26 #id30" parentRef="#id6">
    			<UserData id="id21" type="AttributesInContext">
    				<UserValue value="" title="AO_ID"/>
    				<UserValue value="10" title="SequenceNumber"/>
    				<UserValue value="" title="OccurrenceName"/>
    				<UserValue value="1" title="Quantity"/>
    			</UserData>
    			<UserData id="id22" type="InstanceNotes">
    				<UserValue value="10002598.par:1" title="AIE_OCC_NAME"/>
    				<UserValue value="Occ Id327" title="SE ObjectID"/>
    			</UserData>
    			<Transform id="id19">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</Transform>
    		</Occurrence>
    		<Occurrence id="id46" instancedRef="#id59" instanceRefs="#id64" associatedAttachmentRefs="#id49 #id52 #id56" parentRef="#id6">
    			<UserData id="id47" type="AttributesInContext">
    				<UserValue value="" title="AO_ID"/>
    				<UserValue value="20" title="SequenceNumber"/>
    				<UserValue value="" title="OccurrenceName"/>
    				<UserValue value="1" title="Quantity"/>
    			</UserData>
    			<UserData id="id48" type="InstanceNotes">
    				<UserValue value="Screw_DIN_912_M12x110_v9.00.par:1" title="AIE_OCC_NAME"/>
    				<UserValue value="Occ Id352" title="SE ObjectID"/>
    			</UserData>
    			<Transform id="id45">0 0 -1 0 1 0 0 0 0 -1 0 0 0.0256679460279 0.008500000000000001 -0.029499023116 1</Transform>
    		</Occurrence>
    	</ProductView>
    	<DataSet id="id9" name="10002599/B" accessRefs="#id10" version="1" memberRefs="#id13 #id14 #id15" type="SE Assembly"/>
    	<AccessIntent id="id10" intent="reference" ownerRefs="#id11"/>
    	<Site id="id11" name="IMC-528199808" siteId="528199808">
    		<UserData id="id12">
    			<UserValue value="1" title="dbms"/>
    		</UserData>
    	</Site>
    	<ExternalFile id="id13" accessRefs="#id10" locationRef="10002599.asm" format="asm"/>
    	<ExternalFile id="id14" accessRefs="#id10" locationRef="10002599.cfg" format="cfg"/>
    	<ExternalFile id="id15" accessRefs="#id10" locationRef="10002599_asm.qaf" format="qaf"/>
    	<Form id="id17" name="10002599/D" accessRefs="#id10" subType="smc Revision Master" subClass="smc Revision Master">
    		<UserData id="id18" type="FormAttributes">
    			<UserValue type="int" value="1" title="assemblyType"/>
    		</UserData>
    	</Form>
    	<DataSet id="id24" name="10002598/B" accessRefs="#id10" version="5" memberRefs="#id25" type="DirectModel">
    		<Description>JT File for SE Part</Description>
    	</DataSet>
    	<ExternalFile id="id25" accessRefs="#id10" locationRef="10002598.jt" format="jt"/>
    	<DataSet id="id27" name="10002598/B" accessRefs="#id10" version="5" memberRefs="#id28 #id29" type="SE Part"/>
    	<ExternalFile id="id28" accessRefs="#id10" locationRef="10002598.par" format="par"/>
    	<ExternalFile id="id29" accessRefs="#id10" locationRef="10002598_par.qaf" format="qaf"/>
    	<Form id="id31" name="10002598/B" accessRefs="#id10" subType="smc Revision Master" subClass="smc Revision Master">
    		<UserData id="id32" type="FormAttributes">
    			<UserValue type="int" value="1" title="assemblyType"/>
    		</UserData>
    	</Form>
    	<DataSet id="id50" name="10002600/A" accessRefs="#id10" version="3" memberRefs="#id51" type="DirectModel">
    		<Description>JT File for SE Part</Description>
    	</DataSet>
    	<ExternalFile id="id51" accessRefs="#id10" locationRef="Screw_DIN_912_M12x110_v9.00.jt" format="jt"/>
    	<DataSet id="id53" name="10002600/A" accessRefs="#id10" version="3" memberRefs="#id54 #id55" type="SE Part"/>
    	<ExternalFile id="id54" accessRefs="#id10" locationRef="Screw_DIN_912_M12x110_v9.00.par" format="par"/>
    	<ExternalFile id="id55" accessRefs="#id10" locationRef="Screw_DIN_912_M12x110_v9.00_par.qaf" format="qaf"/>
    	<Form id="id57" name="10002600/A" accessRefs="#id10" subType="smc Revision Master" subClass="smc Revision Master">
    		<UserData id="id58" type="FormAttributes">
    			<UserValue type="int" value="1" title="assemblyType"/>
    		</UserData>
    	</Form>
    </PLMXML>

ตอบทั้งหมด

  • 19 เมษายน 2555 12:15
     
     คำตอบที่เสนอ

    Well if you use processor specific extensions then don't expect to be able to use them with a different XSLT processor from a different vendor.

    There is however a semi-standard EXSLT defining an extension function with the same purpose and Microsoft's XslCompiledTransform supports that (as does Xalan, at least the Java version I think) so you could put e.g.

      xmlns:exsl="http://exslt.org/common"

    on the xsl:stylesheet element and then use

      exsl:node-set($var)

    where you used

      xalan:node-set($var)

    in your stylesheet, that way that part of your stylesheet is more portable.


    MVP Data Platform Development My blog

    • เสนอเป็นคำตอบโดย Martin Honnen 19 เมษายน 2555 14:45
    •