xslt

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

xslt

Post by mwieder » Fri Aug 09, 2013 3:11 am

I just pushed an initial draft of xslt transformations to my repository.
The only function there right now is xsltApplyStyleSheet, and the syntax is

Code: Select all

put xsltApplyStyleSheet pDocID, pPathToStyleSheet)
where pDocID is the result of one of the revXMLCreate functions and pPathToStyleSheet is the path to a style sheet file.

I had to update the libxml libraries to the latest version in order to get this to compile, so it's now up to 2.9.1 as well.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Fri Aug 09, 2013 7:36 pm

(talking to myself again, but here's an update on the xslt transformations)

The following are now available:

Code: Select all

xsltLoadStylesheet( pXmlTreeID ) -- returns Stylesheet ID
xsltLoadStylesheetFromFile( pFilePath ) -- returns Stylesheet ID
xsltFreeStylesheet pStyleSheet -- cleans up memory after a Load function
xsltApplyStylesheet( pXmlTreeID, pStyleSheetID ) -- returns transformed document
xsltApplyStylesheetFile( pXmlTreeID, pFilePath ) -- returns transformed document
so to apply an xslt transformation in a file to an xml data set in a field, you could say

Code: Select all

put revXMLCreateTree(field "xmlData", false, true, false) into tDocID
put xsltApplyStylesheetFile( tDocID, pFilePath) into tTransformedData
or to apply an xslt transformation in a field to an xml data set in another field, you could say

Code: Select all

put revXMLCreateTree(field "xmlData", false, true, false) into tDocID
put revXMLCreateTree(field "xsltInfo", false, true, false) into tXsltID
put xsltLoadStylesheet( tXsltID ) into tStylesheetID
put xsltApplyStylesheet( tDocID, tStylesheetID) into tTransformedData
xsltFreeStylesheet tStylesheetID

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: xslt

Post by malte » Fri Aug 09, 2013 11:29 pm

Mark,

I want to give a big thank you for looking into this. I am still far from being able to get into working on the sources, so there is not much I can do at the moment, however I want to say I really appreciate you look into the XML external.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Tue Sep 10, 2013 7:08 pm

The pull request has been submitted. Everything's the same except there is no longer any need for xsltFreeStylesheet. The normal xml document destructor does the work without imposing an additional load on the developer.

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: xslt

Post by LCMark » Wed Sep 11, 2013 3:20 pm

@mwieder: I've pulled in your xslt additions today and put together makefiles and projects for libxslt fo all the platforms - its in the develop branch and will appear in 6.5-dp-1 which we are hoping to get out asap.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Wed Sep 11, 2013 5:14 pm

@runrevmark - thank you. I spent some time yesterday trying to create proper config files for XCode and have so far failed miserably, so I'll be quite interested to see what you came up with.

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: xslt

Post by LCMark » Wed Sep 11, 2013 5:30 pm

@mwieder: The old trick of 'mutatis mutandis' - copy libxml.xcodeproj, open in Text Edit find/replace libxml with libxslt... Open in Xcode, delete files, add necessary files... Fiddle around for a while... Hope it builds ;)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Wed Sep 11, 2013 6:18 pm

@runrevmark - OK - I see the changes to the Android and iOS project and make files. The Android makefile change looks straightforward, but I'm glad I left the iOS stuff to you - yuck.

It was the libxslt.xcodeproj/project.pbxpro file that eluded me. Did you somehow import the makefile into XCode to get that?

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: xslt

Post by LCMark » Wed Sep 11, 2013 6:21 pm

@mwieder: No - much simpler - I just copied and modified the project.pbxproj from libxml (to preserve the standard settings for libraries we have), then just added the necessary files to the project from the libxslt directory in Xcode.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Wed Sep 11, 2013 6:41 pm

OK - so XCode did all the magic number stuff without you having to fiddle around with the hashes yourself.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Thu Sep 12, 2013 1:09 am

@runrevmark - unfortunately, the changes you made to bring the xslt branch into the develop branch broke the linux build. I have now fixed up the thirdparty stuff and I pushed my two changes into an xslt_fix branch on my repository. The server build is also broken because you fixed up the revxml engine makefile but not the revxml server makefile - it's missing the xslt library include.

With those changes I can get farther along the process of compiling, but then it stops with "make[1]: *** No rule to make target `libskia'. Stop."

Over to you.

Update: I needed a git rebase to include Ian's skia changes. That got me farther along, but I still end up with

./../_build/linux/x86_64/debug/libgraphics.a(context.o): In function `SkStippleMaskFilter::SkStippleMaskFilter()':
/home/mwieder/livecode/libgraphics/./../thirdparty/libskia/include/effects/SkStippleMaskFilter.h:18: undefined reference to `vtable for SkStippleMaskFilter'

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: xslt

Post by LCMark » Thu Sep 12, 2013 10:54 am

@mwieder: These should be fixed now... Hopefully.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: xslt

Post by mwieder » Thu Sep 12, 2013 4:50 pm

Yay! The develop branch builds cleanly for me now on linux.

Locked

Return to “Engine Contributors”