如何使用或执行命令CMD以使用Xalan与Python脚本/代码

时间:2018-01-08 16:50:38

标签: python python-2.7 xalan

我正在完成一项任务,并学习使用Python 2.7和Xalan XSLT处理器进行编程。

代码:

    import wx, os
    from subprocess import call

    def OnImport(self, event):
    if self.Controler is not None and not self.CheckSaveBeforeClosing():
        return
    filepath = ""
    if self.Controler is not None:
        filepath = self.Controler.GetFilePath()
    if filepath != "":
        directory = os.path.dirname(filepath)
    else:
        directory = os.getcwd()


    #Choose Source File
    dialogIn = wx.FileDialog(self, _("Choose a model file"), directory, "",  _("model files (*.xml)|*.xml|All files|*.*"), wx.OPEN)
    if dialogIn.ShowModal() == wx.ID_OK:
        filepath = dialogIn.GetPath()
    else:
        return
    dialogIn.Destroy()


    #Choose Out XML Directory
    dirpath = ""
    dialogOut = wx.DirDialog (self,"Choose Out XML Directory","",wx.OPEN)
    if dialogOut.ShowModal () == wx.ID_OK:
        dirpath =  dialogOut.GetPath ()
        filepathplc = dirpath + "\plc.xml"

    # calling xalan via cmd
        call (['java', '-classpath', '"xalan.jar";"serializer.jar"', 'org.apache.xalan.xslt.Process', '-in', filepath, '-xsl', 'C:\Users\User\Desktop\XSL_Folder\debproj3.xsl', '-out', filepathplc, '/n'])
    else:
        return
    dialogOut.Destroy ()

我想用xalan xslt处理器和调用xalan部分做xslt,但我什么都没得到。我想在cmd中写这个命令:

    java -classpath "xalan.jar";"serializer.jar" org.apache.xalan.xslt.Process -in "source directory file" -xsl "xsl directory file" -out "output  target directory file"

0 个答案:

没有答案