Hey there,
I'm trying to turn XML into plaintext to be added to text field in a form, using the transform option in the XSLT service. However, whenever I put in the tag <xsl:output method="text" />, it seems to fail. I'm just using the test functionality in Workbench even (LiveCycle ES sp2).
Here's my sample XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:value-of select="//user"/>
</xsl:template>
</xsl:stylesheet>
Here's my simple XML:
<users><user>Dave</user></users>
Whenever I try to test it, I get an invocation error.
Now if I do this XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:template match="/">
<html>
<xsl:value-of select="//user"/>
</html>
</xsl:template>
</xsl:stylesheet>
..I get no error, but it's got the html tags, which I don't want.
What am I missing here? Does LiveCycle not support the output tag? Or am I making a dumb mistake somewhere?
Thanks!
Views
Replies
Total Likes
You can use XPath to retrieve the user name rather than running XSLT.
Steve
Views
Replies
Total Likes
I can use XPath to pull the data out, yes. However, I want to XSL because I could have potentially dozens of sub-elements. (The example data is just short for brevity's sake). I figured that XSL would be a quick and simple way of outputting a bunch of XML tags into plaintext without having to muck about with making loops in Workbench or going into Java.
So my issue is the fact that LiveCycle chokes on the output tag, meaning I can never use it to generate text from XML via an XSLT. I wanted to see if there was anything I was missing.
Views
Replies
Total Likes
Hi,
I've always found XSLT bit harder to make it work. But may be it is just me!
For this issue, If I had to manipulate the XML then I would have done via XQuery and not XSLT.
Two main reasons:
1. Syntax is much easy and powerful too!
2. The code is clean so it is better for post production support if anything needs to be tweaked.
Just to give you an idea this is what it takes to implement in XQuery:
Input:
<users>
<user>Dave1</user>
<user>Dave2</user>
<user>Dave3</user>
<user>Dave4</user>
</users>
XQuery syntax:
<HTML>
{for $user in //users/user
return data($user)
}
</HTML>
Output:
<HTML>Dave1 Dave2 Dave3 Dave4</HTML>
I'm going to do a blog post on XQuery soon. I'll post the link here soon.
XQuery is an alternate to XSLT and the LCES component is found at http://www.avoka.com/avoka/escomponents.shtml
XQuery tutorial at http://www.w3schools.com/xquery/default.asp
Hope it helps,
Parth Pandya
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies