Hi, I have a little problem with xslt processing, that you probably can help me with. I have googled looking for an answer for hours.

I'm trying to decode an xml node (Data) that contains 64base encoding to normal readable text because its just xml.
 
I have this xml document that I'm processing to html via the saxon xml parsers.
 
<Data>PHA+VGVzdGluZyBvZiBwbGF0ZXMgY29hdGVkIHdpdGggZXh0cmFjdCBhbmQgcHVyaWZpZWQgRFgx
MTkyIGFuZCBEWDExOTMgR0FEICBhbnRpZ2VucyB0byBkYXRlIGhhdmUgc2hvd24gbm8gYWN0aXZp
dHkgd2l0aCBHQUQgcmVhY3RpdmUgc2VydW0vcGxhc21hIC0gc2VlIEVMTiAgcmVmLiBFNzU4ODU5
NTQtMDktNTggYW5kIDYwLjwvcD4NCjxwPkZ1cnRoZXIgbW9kaWZpY2F0aW9ucyBhbmQgcHVyaWZp
Y2F0aW9ucyBoYXZlIGJlZW4gY2FycmllZCBvbiB0aGUgYW50aWdlbiAgZXh0cmFjdHMuIFRoZXNl
IGluY2x1ZGU6PC9wPg0KPHA+RXh0cmFjdHMgb2YgRFgxMTkyIGFuZCBEWDExOTMgcmVkdWNlZCB3
aXRoIERUVCBhbmQgYmxvY2tlZCB3aXRoIE5FTS48L3A+DQo8cD5FeHRyYWN0IG9mIERYMTE5MiBy
ZWR1Y2VkIHdpdGggRFRUIGFuZCBibG9ja2VkIHdpdGggTkVNIHRoZW4gZGlhbHlzZWQgaW50byAg
MjVtTSBIZXBlcwFtTSBFRFRBOE0gdXJlYSBwSDcuODwvcD4NCjxwPkV4cmFjdCBvZiBEWDExOTIg
Ym9pbGVkIGluIFNEUy8yTWUgYnVmZmVyPC9wPg0KPHA+RXh0cmFjdCBvZiBEWDExOTIgdHJlYXRl
ZCB3aXRoIEE0IGFuZCBwdXJpZmllZCBpbiBidWZmZXJzIGNvbnRhaW5pbmcgQTQ8L3A+DQo8cD5U
aGVzZSB3ZXJlY29hdGVkIG9uIE51bmMgcGxhdGVzIGluIGNhcmIvYmljYXJiIGNvYXRpbmcgYnVm
ZmVyIHBIOS42IGFuZCAgY2FyYi9iaWNhcmIgY29hdGluZyBidWZmZXIgKzAuMDEyNSUgU0RTIHBI
OS42LjwvcD4NCjxwPkFsc28gY29hdGVkIHdhcyBhIGZ1bGwgbGVuZ3RoIEdBRCByZWNvbWJpbmFu
dCBib3VnaHQgaW4gZnJvbSBBYm5vdmEuPC9wPg0K
</Data>
 
I'm trying to convert this to the underlining xml
 
<xsl:value-of select="saxon:base64Binary-to-string(xs:base64Binary(Data), 'UTF8')"/>       
 
or
 
<xsl:value-of select="saxon:base64Binary-to-string(xs:base64Binary(Data/text()), 'UTF8')"/>       
 
but I'm getting the following error with saxon 9.x
 
X:\>"java net.sf.saxon.Transform -s:42133.xml -xsl:publish.xsl -o:"42133.htm"
net.sf.saxon.trans.XPathException: The byte sequence contains a character not al
lowed by XML (hex 1)
        at net.sf.saxon.functions.Extensions.checkBytes(Extensions.java:842)
        at net.sf.saxon.functions.Extensions.base64BinaryToString(Extensions.jav
a:769)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at net.sf.saxon.functions.ExtensionFunctionCall.invokeMethod(ExtensionFu
nctionCall.java:688)
        at net.sf.saxon.functions.ExtensionFunctionCall.call(ExtensionFunctionCa
ll.java:343)
        at net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctio
nCall.java:224)
        at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:352)
        at net.sf.saxon.instruct.SimpleContentConstructor.evaluateItem(SimpleCon
tentConstructor.java:261)
        at net.sf.saxon.instruct.ValueOf.processLeavingTail(ValueOf.java:243)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreato
r.java:296)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreato
r.java:296)
        at net.sf.saxon.instruct.Template.expand(Template.java:220)
        at net.sf.saxon.instruct.CallTemplate.process(CallTemplate.java:257)
        at net.sf.saxon.instruct.CallTemplate.processLeavingTail(CallTemplate.ja
va:281)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreato
r.java:296)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:686)
        at net.sf.saxon.instruct.Template.expand(Template.java:220)
        at net.sf.saxon.instruct.CallTemplate$CallTemplatePackage.processLeaving
Tail(CallTemplate.java:440)
        at net.sf.saxon.instruct.CallTemplate.process(CallTemplate.java:259)
        at net.sf.saxon.instruct.CallTemplate.processLeavingTail(CallTemplate.ja
va:281)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreato
r.java:296)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreato
r.java:296)
        at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.ja
va:345)
        at net.sf.saxon.Controller.transformDocument(Controller.java:1807)
        at net.sf.saxon.Controller.transform(Controller.java:1621)
        at net.sf.saxon.Transform.processFile(Transform.java:1112)
        at net.sf.saxon.Transform.doTransform(Transform.java:719)
        at net.sf.saxon.Transform.main(Transform.java:66)
Error on line 78 of enote.xsl:
  XTDE1180: Error in call to extension function {public static java.lang.String
  net.sf.saxon.functions.Extensions.base64BinaryToString(net.sf.saxon.expr.XPath
Context,net.sf.saxon.value.Base64BinaryValue,java.lang.String) throws java.lang.
Exception}: The byte sequence contains a character not allowed by XML (hex 1)
  at xsl:call-template name="displayeNote" (file:/C:/OPENTEXT/livelink4/support/
enovatorpublisher/enote.xsl#20)
  at xsl:call-template name="eNote" (file:/C:/OPENTEXT/livelink4/support/enovato
rpublisher/main.xsl#80)
  at xsl:call-template name="main" (file:/C:/OPENTEXT/livelink4/support/enovator
publisher/publish.xsl#42)
Transformation failed: Run-time errors were reported
 
 
Can you please point out what I'm doing wrong,
 
Many Thanks
Karl