You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "Maxim Y. Tebenev" <mt...@softech.ru> on 2006/12/27 13:25:49 UTC
Retrieving message properties from XSL
Hello Guys,
Does anybody knows message properties inside of xsl script?
For example I have sorce xml like:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:shop="http://Shop.HelloBook.softech.com">
<soapenv:Header/>
<soapenv:Body>
<shop:BuyBook>
<shop:customerID>112</shop:customerID>
<shop:bookName>ARM</shop:bookName>
</shop:BuyBook>
</soapenv:Body>
</soapenv:Envelope>
and want to extract customerID and bookName values from that. What's the
right way to do that?
I've tried following with no luck:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:shop="http://Shop.HelloBook.softech.com">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:war="http://Warehouse.HelloBook.softech.com">
<soapenv:Header/>
<soapenv:Body>
<war:OrderBook>
<war:customerID>
<xsl:value-of select="$shop:customerID"/>
</war:customerID>
<war:bookName>
<xsl:value-of select="$shop:bookName"/>
</war:bookName>
</war:OrderBook>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
Help me with this issue please.
Best regards, Maxim Tebenev.
--
View this message in context: http://www.nabble.com/Retrieving-message-properties-from-XSL-tf2885851s12049.html#a8062254
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Retrieving message properties from XSL
Posted by Kevinjj <ke...@yahoo.com>.
Inside you XML file, you define your param names like
<xsl:param name="title"/>
<xsl:param name="description"/>
<xsl:param name="author"/>
<xsl:param name="invoiceNumber"/>
and use them like this. for ex.
xsl:choose>
<xsl:when test="local-name()='title'">
<xsl:value-of select="$title"/>
</xsl:when>
<xsl:when test="local-name()='description'">
<xsl:value-of select="$description"/>
</xsl:when>
<xsl:when test="local-name()='author'">
<xsl:value-of select="$author"/>
</xsl:when>
<xsl:when test="local-name()='invoiceNumber'">
<xsl:value-of select="$invoiceNumber"/>
</xsl:when>
</xsl:choose>
You can set parameters within your MessageExchange for ex.
//set parameters to the XSLT service engine
//which will be used by the stylesheet
out.setProperty("systemdate",datetime );
out.setProperty("title", "Invoice Document");
Hth,
Prem
Maxim Y. Tebenev wrote:
>
> Hello Guys,
>
> Does anybody knows message properties inside of xsl script?
>
> For example I have sorce xml like:
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:shop="http://Shop.HelloBook.softech.com">
> <soapenv:Header/>
> <soapenv:Body>
> <shop:BuyBook>
> <shop:customerID>112</shop:customerID>
> <shop:bookName>ARM</shop:bookName>
> </shop:BuyBook>
> </soapenv:Body>
> </soapenv:Envelope>
>
> and want to extract customerID and bookName values from that. What's the
> right way to do that?
> I've tried following with no luck:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:shop="http://Shop.HelloBook.softech.com">
> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
> <xsl:template match="/">
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:war="http://Warehouse.HelloBook.softech.com">
> <soapenv:Header/>
> <soapenv:Body>
> <war:OrderBook>
> <war:customerID>
> <xsl:value-of select="$shop:customerID"/>
> </war:customerID>
> <war:bookName>
> <xsl:value-of select="$shop:bookName"/>
> </war:bookName>
> </war:OrderBook>
> </soapenv:Body>
> </soapenv:Envelope>
> </xsl:template>
> </xsl:stylesheet>
>
> Help me with this issue please.
>
> Best regards, Maxim Tebenev.
>
--
View this message in context: http://www.nabble.com/Retrieving-message-properties-from-XSL-tf2885851s12049.html#a8065316
Sent from the ServiceMix - User mailing list archive at Nabble.com.