It would appear you do not have a template that matches "/" or you do not have
a template to match every element.
If you are doing an identity transform the simplest template should match and
do a copy of the nodes that don't match any other template.
<xsl:stylesheet .. version="2.0">
<!-- Other Templates here -->
<xsl:template match="@*|node">
<xsl:copy>
<xsl:appy-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Another issue is that $doc may not be a document node but an element node.
Always wrap your node in document {} like
xdmp:xslt-invoke("example.xsl", if($node instance of document-node() then $doc
else document {$doc}, (), ())*
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Monday, November 24, 2014 3:00 PM
To: [email protected]
Subject: General Digest, Vol 125, Issue 38
Send General mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific than "Re:
Contents of General digest..."
Today's Topics:
1. Marklogic XSLT transformer returning file without any tags
(S.Gowtham)
2. Re: Marklogic XSLT transformer returning file without any
tags (Christopher Hamlin)
3. Re: Marklogic XSLT transformer returning file without any
tags (Florent Georges)
----------------------------------------------------------------------
Message: 1
Date: Mon, 24 Nov 2014 18:58:08 +0800
From: "S.Gowtham" <[email protected]>
Subject: [MarkLogic Dev General] Marklogic XSLT transformer returning
file without any tags
To: [email protected]
Message-ID:
<CAGDVLc3oZui07c4cQ1aT0nv0fHvoGwAZ1VmS=jq2ntr-upf...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
I invoked below transformation query to transform the xml with xslt.
*xdmp:xslt-invoke("example.xsl", $doc, (), ())*
In example.xsl contains below contents.
*<xsl:template match="CaseRef">*
* <xsl:variable xmlns:encoder="xalan://java.net.URLEncoder"
name="urlEncodedCit"*
* select="encoder:encode( substring( string(@href),2))"/>*
*<xsl:value-of select="$urlEncodedCit"/>*
*</xsl:template>*
But the marklogic query console returned file without any tags. It seems to me
that, the file is not transformed correctly.
Can anyone help me to solve the issue.
Thanks,
Best Regards,
$.Gowth@m
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://developer.marklogic.com/pipermail/general/attachments/20141124/f5919d7a/attachment-0001.html
------------------------------
Message: 2
Date: Mon, 24 Nov 2014 09:05:39 -0500
From: Christopher Hamlin <[email protected]>
Subject: Re: [MarkLogic Dev General] Marklogic XSLT transformer
returning file without any tags
To: MarkLogic Developer Discussion <[email protected]>
Message-ID:
<cadx+0qw0a3sms2orf00pxdexujb4bppfcidhyt5yzlgnis3...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Hi,
If that is the complete contents of the xsl, then what you should get back is
all the text in the source file with the href attribute text from the CaseRef
tags.
xslt has default templates that would match anything but CaseRef, but they only
return text.
Check the top answer here for an explanation:
http://stackoverflow.com/questions/3360017/why-does-xslt-output-all-text-by-default
/ch
On Mon, Nov 24, 2014 at 5:58 AM, S.Gowtham <[email protected]> wrote:
>
> Hi all,
>
>
> I invoked below transformation query to transform the xml with xslt.
>
> xdmp:xslt-invoke("example.xsl", $doc, (), ())
>
> In example.xsl contains below contents.
>
> <xsl:template match="CaseRef">
> <xsl:variable xmlns:encoder="xalan://java.net.URLEncoder"
> name="urlEncodedCit"
> select="encoder:encode( substring( string(@href),2))"/>
> <xsl:value-of select="$urlEncodedCit"/> </xsl:template>
>
> But the marklogic query console returned file without any tags. It
> seems to me that, the file is not transformed correctly.
>
> Can anyone help me to solve the issue.
>
> Thanks,
>
> Best Regards,
>
> $.Gowth@m
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
------------------------------
Message: 3
Date: Mon, 24 Nov 2014 16:36:30 +0100
From: Florent Georges <[email protected]>
Subject: Re: [MarkLogic Dev General] Marklogic XSLT transformer
returning file without any tags
To: MarkLogic Developer Discussion <[email protected]>
Message-ID:
<CADyR_r2oCCMO=vLScH8wH5bGg5t_RXi+iUQT=vk2besg1ea...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
In order for us to help you, you should provide the content of $doc, the
content of example.xsl (reduced to the minimal form reproducing the problem you
have). As well as the expected output and the actual output you get.
I see that you also use a Xalan-specific extension, calling back some Java
function from XPath. Given the name of the Java class, I guess you should use
fn:encode-for-uri instead:
http://w3.org/TR/xpath-functions/#func-encode-for-uri
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
On 24 November 2014 at 11:58, S.Gowtham wrote:
>
> Hi all,
>
>
> I invoked below transformation query to transform the xml with xslt.
>
> *xdmp:xslt-invoke("example.xsl", $doc, (), ())*
>
> In example.xsl contains below contents.
>
>
> *<xsl:template match="CaseRef">*
> * <xsl:variable xmlns:encoder="xalan://java.net.URLEncoder"
> name="urlEncodedCit"*
> * select="encoder:encode( substring( string(@href),2))"/>*
> *<xsl:value-of select="$urlEncodedCit"/>*
> *</xsl:template>*
>
> But the marklogic query console returned file without any tags. It seems
> to me that, the file is not transformed correctly.
>
> Can anyone help me to solve the issue.
>
> Thanks,
>
> Best Regards,
>
> $.Gowth@m
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://developer.marklogic.com/pipermail/general/attachments/20141124/cec0a27b/attachment-0001.html
------------------------------
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
End of General Digest, Vol 125, Issue 38
****************************************
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general