changeset 33:c1a2f3e5d8a9

~ fix get and apply xslt file generated previously
author Denis Ah-Kang <denis@w3.org>
date Wed, 10 Aug 2011 14:18:32 +0200
parents 25e927e9ca98
children 27ea2c63a0ff
files src/main/scala/Main.scala
diffstat 1 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/scala/Main.scala	Tue Aug 09 16:58:47 2011 -0400
+++ b/src/main/scala/Main.scala	Wed Aug 10 14:18:32 2011 +0200
@@ -104,7 +104,7 @@
     val pubrules = unfiltered.filter.Planify {
       case Path(Seg("pubrules" :: Nil)) & Params(params) if params contains "uri" => {
 
-        val spec = "http://www.w3.org/TR/2011/WD-turtle-20110809/Overview.html"
+        val spec = "http://www.w3.org/TR/2004/WD-i18n-html-tech-char-20040509/"
 
         val xsltParams:Map[String, String] =
           Map(
@@ -135,6 +135,7 @@
         val trans1:XsltTransformer = exp1.load()
         trans1.setInitialContextNode(source1)
         trans1.setParameter(new QName("", "", "uri"), new XdmAtomicValue(spec))
+        xsltParams foreach { case (k, v) => trans1.setParameter(new QName("", "", k), new XdmAtomicValue(v))}
 
         // xsl1 | frame.xsl -> xsl2
         val frame = "http://www.w3.org/2005/09/checker/frame.xsl"
@@ -142,22 +143,40 @@
         xslt2StreamSource.setSystemId(frame)
         val exp2:XsltExecutable = comp.compile(xslt2StreamSource)
         val trans2:XsltTransformer = exp2.load()
+        trans2.setParameter(new QName("", "", "display"), new XdmAtomicValue("all"))
+        trans2.setParameter(new QName("", "", "recurse_auth"), new XdmAtomicValue("on"))
 
-        trans1.setDestination(trans2)
-        
         // xhtml | xsl2 -> result
         // param: doc_uri
         val doc:XdmNode =
           proc.newDocumentBuilder().build(new StreamSource(new URL(spec).openStream()))
-        trans2.setInitialContextNode(doc)
-        trans2.setParameter(new QName("", "", "doc_uri"), new XdmAtomicValue(spec))
+        val xsl3:XdmDestination = new XdmDestination()
+
+
 
         new ResponseStreamer {
           def stream(os:OutputStream):Unit = {
             val out:Serializer = new Serializer()
             out.setOutputStream(os)
-            trans2.setDestination(out)
-            trans2.transform()
+            //out.setOutputProperty(Serializer.Property.METHOD, "xhtml");
+            //out.setOutputProperty(Serializer.Property.MEDIA_TYPE, "text/html");
+            //out.setOutputProperty(Serializer.Property.INDENT, "yes");
+            trans1.setDestination(trans2)
+
+            trans2.setDestination(xsl3)
+
+
+
+            trans1.transform()
+        val exp3:XsltExecutable = comp.compile(xsl3.getXdmNode().asSource())
+        val trans3:XsltTransformer = exp3.load()
+        trans3.setInitialContextNode(doc)
+        trans3.setParameter(new QName("", "", "doc_uri"), new XdmAtomicValue(spec))
+        xsltParams foreach { case (k, v) => trans3.setParameter(new QName("", "", k), new XdmAtomicValue(v))}
+            trans3.setDestination(out)
+        
+        trans3.transform()
+
           }
         }
 
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.