2 Replies Latest reply on Jun 22, 2009 4:28 AM by john beardsworth

    Adding XSLT to XML output

    john beardsworth Adobe Community Professional & MVP

      Is it possible to specifiy the XSLT file as part of an XML output? I've got XML output working fine, and reading too *, but for this plugin I want all data present in the XML file, and with the XSL summoned in the file's header? Can I do this with the SDK?

       

      John

       

      * Anyone seen XPATH? Is it missing from the SDK?

        • 1. Documentation query
          john beardsworth Adobe Community Professional & MVP

          xmlDomInstance:text() appears to work, but isn't documented.

           

          I wonder if there's anything else.

           

          John

          • 2. Re: Documentation query
            john beardsworth Adobe Community Professional & MVP

            OK, here is how I did it. The key is to set theXML instance so the XML declaration is omitted:

             

            local xmlBuilder = LrXml.createXmlBuilder(true)

             

            Then you can add the declaration by code, add the XSLT stylesheet link in the same manner, and then the XML blocks. So, assuming FileStr is the name of the XML file and xmlString contains the data you're exporting:

             

            Hnd = io.open(FileStr, "w")
            Hnd:write ( '<?xml version="1.0"?>'  )
            Hnd:write ( '<?xml-stylesheet type="text/xsl" href="spreadsheet.xsl"?>' )
            Hnd:write (xmlString)
            Hnd:close ()

             

            John