• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to save all nodes in a variable

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to save the all structure in a xsl:variable, but this code doesn't work. Can someone help me?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:user="userhtml">
<xsl utput method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:variable name="xmlInput">
<xsl:copy-of select="."/>
</xsl:variable>

<XSLTValidationResults>
<!-- test -->
<xsl:value-of select="$xmlInput"/>
</XSLTValidationResults>
</xsl:template>
</xsl:stylesheet>
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brian, it looks that you need to use xsl:copy-of in the second case also:
...
<XSLTValidationResults>
<!-- test -->
<xsl:copy-of select="$xmlInput"/>
</XSLTValidationResults>
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right, I found it after I posted.
I wanted to keep the xml in xsl:variable because it would be used in VBScript function like this:
<xsl:copy-of select="user:AdditionalBusinessRules($xmlInput)"/>
But I got this error :
Microsoft VBScript runtime error
Type mismatch: 'objXML.LoadXML'
I need your help again
<ms:script language="VBScript" implements-prefix="user">
function AdditionalBusinessRules(strXML)
Set objXML = CreateObject("MSXML2.DOMDocument.3.0")
Set objXSL = CreateObject("MSXML2.DOMDocument.3.0")

objXML.async = False
objXML.LoadXML strXML

objXML.save ("D:\CAS\DEV\Data\CAS_Result_AdditionalBusinessRules_Input.xml")
objXSL.async = False
objXSL.Load ("D:\CAS\DEV\Data\BCEECreditApp_AdditionalBusinessRules_2.1.5.xsl")

strXMLResult = objXML.transformNode(objXSL)

objXML.LoadXML strXMLResult
objXML.save ("D:\CAS\DEV\Data\CAS_Result_AdditionalBusinessRules_Output.xml")

AdditionalBusinessRules = objXML.xml
End function
</ms:script>
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you know why I got this output:
<?xml version="1.0" encoding="UTF-8"?>
<XSLTValidationResults version="1.0.0.0" service="CAS" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:user="userhtml">
<Test code="CAS_IND_CONTACT_M"><Success/></Test>
<Test code="CAS_IND_NAME_M"><Success/></Test>
<Test code="CAS_IND_DOB_M"><Success/></Test>
</XSLTValidationResults>
for this
<xsl:copy-of select="user:LenderSpecificRules()"/>

function LenderSpecificRules()
Set objXML = CreateObject("MSXML2.DOMDocument.3.0")
Set objXSL = CreateObject("MSXML2.DOMDocument.3.0")

objXML.async = False
objXML.Load ("D:\CAS\DEV\Data\CreditApp_BeforeTransformation.xml")

objXML.save ("D:\CAS\DEV\Data\CAS_Result_LenderSpecificRules_Input.xml")
objXSL.async = False
objXSL.Load ("D:\CAS\DEV\Data\BCEECreditApp_LenderSpecificRules_2.1.5.xsl")

strXMLResult = objXML.transformNode(objXSL)

objXML.LoadXML strXMLResult
objXML.save ("D:\CAS\DEV\Data\CAS_Result_LenderSpecificRules_Output.xml")

LenderSpecificRules= objXML.xml
End function
How can I replace < and > to < and >?
I know that I'm using VBScript. I have no choice.
I prefer working on Java
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops sorry
& lt; and & gt; have been converted automaticaly
How can replace & lt; by <
<?xml version="1.0" encoding="UTF-8"?>
<XSLTValidationResults version="1.0.0.0" service="CAS" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:user="userhtml">
& lt;Test code="CAS_IND_CONTACT_M"><Success/& gt;& lt;/Test& gt;
& lt;Test code="CAS_IND_NAME_M"><Success/& gt;& lt;/Test& gt;
& lt;Test code="CAS_IND_DOB_M"><Success/& gt;& lt;/Test& gt;
</XSLTValidationResults>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic