From: Steve B. <Ste...@zv...> - 2003-06-18 21:42:51
|
wjax . wrote: > I have tried to do this: > > package require xslt 2.6 > package require dom 2.6 > set XML "c:/tcl/to_translate.xml" > set xls "c:/tcl/rules.xls" > set source_doc [::dom::libxml2::parse $XML] > set ssheet_doc [::dom::libxml2::parse $xls] > set ssheet [::xslt::compile $ssheet_doc] > set result [$ssheet transform $source_doc] > > and it gives an error, it does not find "<", so i have though that the > $XML must be a string with all the file read inside. Correct. > So i have tried this: > > package require xslt 2.6 > package require dom 2.6 > set ch [open c:/tcl/meta.xml] > fconfigure $ch -encoding shiftjis > set XML [read $ch] > set ch1 [open c:/tcl/engtra.xsl] > fconfigure $ch1 -encoding shiftjis > set xls [read $ch1] > set source_doc [::dom::libxml2::parse $XML] > set ssheet_doc [::dom::libxml2::parse $xls] > set ssheet [::xslt::compile $ssheet_doc] > set result [$ssheet transform $source_doc] > > And now it does not give error but it does not show anything, it says > only "doc3" or something like that. But it does not return a translated > file.... You must serialize the DOM tree of the result document, ie: puts [dom::serialize $result] HTHs, Steve Ball -- Steve Ball | XSLT Standard Library | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development Ste...@zv... +---------------------------+--------------------- Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099 |