Topic
  • 6 replies
  • Latest Post - ‏2014-05-26T22:36:02Z by 6QMG_Elayaraja_Kathirvel
Ramsyee
Ramsyee
130 Posts

Pinned topic replacement for document() function in xslt

‏2013-03-20T18:37:37Z |
Hi Guys

Is there any replacement for document function in xslt, if yes can you please let me know what function it is.

searching through forums found,Url-open can do, but can dp url open function can call local file on box itself?

Thanks for the help
Updated on 2013-03-24T00:29:38Z at 2013-03-24T00:29:38Z by SystemAdmin
  • kenhygh
    kenhygh
    2162 Posts

    Re: replacement for document() function in xslt

    ‏2013-03-20T20:22:56Z  
    what do you mean by 'call a local file'?
  • Ramsyee
    Ramsyee
    130 Posts

    Re: replacement for document() function in xslt

    ‏2013-03-20T22:21:10Z  
    • kenhygh
    • ‏2013-03-20T20:22:56Z
    what do you mean by 'call a local file'?
    reading a local file from local directory as below
    <xsl:variable name="File" select="document('local:///POC/Test.xml')"/>

    Here is my complete xslt

    <xsl:stylesheet exclude-result-prefixes="dp" extension-element-prefixes="dp dpconfig dpfunc" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config" xmlns:dpfunc="http://www.datapower.com/extensions/functions"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dom="http://www.schema.services.customer.com/dom/">

    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dom1="http://www.schema.services.customer.eix.com/">
    <soapenv:Header>

    <!--insert the following inside the soap:Header tag-->

    <xsl:variable name="File" select="document('local:///POC/Test.xml')"/>
    <TempParams:reqCode xmlns:TempParams="http://cust.services.org" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <TempParams:reqInfo>information from request</TempParams:reqInfo>
    <TempParams:sysid><xsl:value-of select="$File/Services/TempParams/sysid"/> </TempParams:sysid>
    </TempParams:reqCode>
    </soapenv:Header>
    <soapenv:Body>
    <xsl:apply-templates select="soapenv:Envelope/soapenv:Body"/>
    </soapenv:Body>
    </soapenv:Envelope>
    </xsl:template>
    <xsl:template match="soapenv:Body">
    <xsl:copy-of select="@*|node()"/>
    </xsl:template>
    </xsl:stylesheet>

    All this xsl does is, inserts the sysid as a part of soapheader in the payload, SysID value is read from the Test.xml file which is stored in "local:///Poc/Test.xml"
    please let me know if you have any questions

    Thanks
  • HermannSW
    HermannSW
    6380 Posts

    Re: replacement for document() function in xslt

    ‏2013-03-20T23:28:25Z  
    • Ramsyee
    • ‏2013-03-20T22:21:10Z
    reading a local file from local directory as below
    <xsl:variable name="File" select="document('local:///POC/Test.xml')"/>

    Here is my complete xslt

    <xsl:stylesheet exclude-result-prefixes="dp" extension-element-prefixes="dp dpconfig dpfunc" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config" xmlns:dpfunc="http://www.datapower.com/extensions/functions"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dom="http://www.schema.services.customer.com/dom/">

    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dom1="http://www.schema.services.customer.eix.com/">
    <soapenv:Header>

    <!--insert the following inside the soap:Header tag-->

    <xsl:variable name="File" select="document('local:///POC/Test.xml')"/>
    <TempParams:reqCode xmlns:TempParams="http://cust.services.org" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <TempParams:reqInfo>information from request</TempParams:reqInfo>
    <TempParams:sysid><xsl:value-of select="$File/Services/TempParams/sysid"/> </TempParams:sysid>
    </TempParams:reqCode>
    </soapenv:Header>
    <soapenv:Body>
    <xsl:apply-templates select="soapenv:Envelope/soapenv:Body"/>
    </soapenv:Body>
    </soapenv:Envelope>
    </xsl:template>
    <xsl:template match="soapenv:Body">
    <xsl:copy-of select="@*|node()"/>
    </xsl:template>
    </xsl:stylesheet>

    All this xsl does is, inserts the sysid as a part of soapheader in the payload, SysID value is read from the Test.xml file which is stored in "local:///Poc/Test.xml"
    please let me know if you have any questions

    Thanks
    Hi,

    you "should not" experience problems with document() function.
    If you do, please create a PMR and it will be fixed if there is something to fix.
    What kind of "problem" do you experience?
    <dp:url-open target=" 'local:///...' " .../> does not work, as you have experienced.
    A workaround is to create a HTTP Service object listening on 127.0.0.1 at say port 8888 with base directory "local:///".
    (This is more secure than "0.0.0.0" since only services from the appliance can access that)

    Then <dp:url-open target=" 'http:///127.0.0.1:8888/...' " .../> might be what you are looking for.

    But again, if you experience a problem with document(), then please create a PMR.

     
    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>
  • Ramsyee
    Ramsyee
    130 Posts

    Re: replacement for document() function in xslt

    ‏2013-03-21T18:57:20Z  
    • HermannSW
    • ‏2013-03-20T23:28:25Z
    Hi,

    you "should not" experience problems with document() function.
    If you do, please create a PMR and it will be fixed if there is something to fix.
    What kind of "problem" do you experience?
    <dp:url-open target=" 'local:///...' " .../> does not work, as you have experienced.
    A workaround is to create a HTTP Service object listening on 127.0.0.1 at say port 8888 with base directory "local:///".
    (This is more secure than "0.0.0.0" since only services from the appliance can access that)

    Then <dp:url-open target=" 'http:///127.0.0.1:8888/...' " .../> might be what you are looking for.

    But again, if you experience a problem with document(), then please create a PMR.

     
    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>
    Thanks Hermann,
    I have created the PMR
    Thanks for the help
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: replacement for document() function in xslt

    ‏2013-03-24T00:29:38Z  
    • Ramsyee
    • ‏2013-03-21T18:57:20Z
    Thanks Hermann,
    I have created the PMR
    Thanks for the help
    can you try with local:// instead of local:///
  • 6QMG_Elayaraja_Kathirvel
    82 Posts

    Re: replacement for document() function in xslt

    ‏2014-05-26T22:36:02Z  
    • Ramsyee
    • ‏2013-03-21T18:57:20Z
    Thanks Hermann,
    I have created the PMR
    Thanks for the help

    Hi,

    Have you got solution for this?