Apply XSLT to Source/Target XMLs

Hi,

I'm in the process of drafting a workflow in which I'd like to apply an XSLT to the source and target XML files. I do have an automatic action called 'Apply XSLT' in the workflow editor, except all this seems to do is strip the files off all content, irrespective of what XMLs and XSLTs I feed it (unless I don't understand how it works).

The thing is, I'm not even sure if this AA is part of the core product or if it's a custom component of our specific installation. I can't find it in either SDL's or our own documentation.

Can anyone confirm that this is a standard workflow action and not something that was custom-programmed for us? And has anyone used it successfullly?

 

Thanks,

Stephan

  • That AA is something that comes as a sample with WS. You can find documentation for it in the samples of the WS SDK. That particular AA's doc would be found at: wssdk_[VERSION_OF_WS]/samples/docs/api/com/idiominc/wssdk/samples/component/autoaction/tools/ApplyXSLTAutomaticAction.html.

    You can find documentation on all samples at
    wssdk_[VERSION_OF_WS]\samples\docs\api

    I know our organization has used this with success. Let me know if the above doesn't help you.
  • Hi Eric,

    Thanks for your reply. I'm hopeful now that it's really me and not the AA. The AA looks pretty self-explaining, though, and I can't find any hints as to where I'm going wrong in the documentation. I can't seem to make it work.

    I just created a simple, valid XML file and an XSLT with nothing more in it than an identity transform. In EditiX, I can apply the stylesheet just fine.

    In my workflow, however, the AA always throws an Auto Error: 'Could not apply stylesheet: Premature end of file.'

    I load the XML from source and save the result to source. The error even makes sense to some extent because upon checking the source file is now indeed empty. I've no idea though why that happens.

    Do you have any idea what I'm doing wrong? Below are my sample files.

    Thanks,

    Stephan

    [edit] I just discovered that the AA works as expected when I load from source and save to target. However, I want to modify the source file prior to segmentation, just like in the sample workflow provided in the documentation--and eventually reverse part of the modification in the target file post-translation via another XSLT.

     

    XML:

    <?xml version="1.0" encoding="UTF-8"?>

    <Document>

    <Content>Blahblah <br/> blah <br></br> More blah
    </Content>

    </Document>

     

    XSLT:

    <?xml version="1.0" encoding="UTF-8" ?>

    <xsl:stylesheet version="1.0" xmlns:xsl="www.w3.org/.../Transform">

    <xsl:output method="xml" indent="yes"/>

        <xsl:template match="@* | node()">
                <xsl:copy>
                    <xsl:apply-templates select="@* | node()"/>
                </xsl:copy>
        </xsl:template>

    </xsl:stylesheet>

  • Unfortunately this is not something i know and use on a frequent basis, i have a colleague that does but our organization is all hands for a very large project right now and I nor he could really focus on this for the time needed to determine the issue. Hopefully someone here can help you instead. Sorry
  • Hi Eric,

    No worries. You were a massive help (always are). I think now that I know this is technically a stock AA I'm going to take this up with SDL Support, because why it doesn't work as expected is over my head.

    Thanks for your help!
    Stephan
  • To wrap this up, SDL have meanwhile confirmed that--and I quote--'This Auto Action sample does not allow a source-source modification as it is does not have sufficient logic built in.'

    They have provided me with a modified version of the AA though that allows a target-source transformation. So before anything else in the workflow I now copy source to target, apply the XSLT to the target file and save that to source. And it works like a charm.

     

    , I was so snowed under I never even said thank you before the ticket was closed. Thank you!

     

    Stephan