Jump to content

Experts In Xslt/xsl -- An Update


Recommended Posts

Posted

Any one who worked extensively on these techs like

Using some of the following



apply-imports
apply-templates
attribute Adds
attribute-set
call-template
choose
comment
copy
copy-of
for-each

Some of them

Posted

are you looking for all the elements in XSLT?????[img]http://lh5.ggpht.com/-3UO2FC9JEjI/TnyumlfaXFI/AAAAAAAAEWE/CliOcqKZWnI/Brahmi-10.gif[/img]


if soo
<xsl:choose>
<xsl:when>
<xsl:valu-of>



[center]Axis[/center]
[center]Abbreviation[/center]
[center]Description[/center]
child
(empty string)
All the direct children (no grandchildren, attribute nodes, or namespaces)
descendant
//
All the children (no attribute nodes or namespaces)
parent
..
the immediate parent
ancestor
all the nodes above this one until the root is reached
following-sibling
all siblings after current node
preceding
all sibling before this node
following
all the nodes after this one, but not its descendents
preceding
all the nodes before this one (no ancestors, attributes, or namespaces)
attribute
@
all the attribute nodes for this node
namespace
namespaces nodes of the context node
self
.
the context node itself
descendant-or-self
all descendents and self
ancestor-or-self
all ancestors and self

Posted

[quote name='bombaypriyudu' timestamp='1345557441' post='1302348103']
are you looking for all the elements in XSLT?????[img]http://lh5.ggpht.com/-3UO2FC9JEjI/TnyumlfaXFI/AAAAAAAAEWE/CliOcqKZWnI/Brahmi-10.gif[/img]


if soo
<xsl:choose>
<xsl:when>
<xsl:valu-of>



[/quote]
Yep

Now i want to add error condition here when some value is not found exit form here and throw error

and another one i have my own java classes i would like to call my classes in some conditions

Posted

for this reason i think.

you can use <xsl:when> condition the exact structure as below.

<xsl:template match="element">
<xsl:choose>
<xsl:when test="put the condition which you want to throw or anything else(give the exact XPATH)">
<xsl:applytemplates/>
</xsl:when>
<xsl:otherwise>
do whatever you normally would
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Posted

[quote name='bombaypriyudu' timestamp='1345558146' post='1302348221']
for this reason i think.

you can use <xsl:when> condition the exact structure as below.

<xsl:template match="element">
<xsl:choose>
<xsl:when test="put the condition which you want to throw or anything else(give the exact XPATH)">
<xsl:applytemplates/> or <xsl:apply-templates select="."/> or however you would process the text element
</xsl:when>
<xsl:otherwise>
do whatever you normally would
</xsl:otherwise>
</xsl:choose>
</xsl:template>
[/quote]

for this reason i think.

you can use <xsl:when> condition the exact structure as below.

<xsl:template match="element">
<xsl:choose>
<xsl:when test="put the condition which you want to throw or anything else(give the exact XPATH)">
<xsl:applytemplates/> or <xsl:apply-templates select="."/> or however you would process the text element
</xsl:when>
<xsl:otherwise>
do whatever you normally would
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Posted

thanks a lot MumbaiPriyudu

Posted

May be my Q was not clear this what i wanted and i able find it finally
Thx to mumbaipriyudu

To call a JAVA Object in xslt
we normally use
<xsl:value-of select="java:com..eip.config.EnvironmentConfigReader.getValue('UID')" />

The above way can be used only for static methods

to call any java object in xslt we need to do following steps
1) add attribute to <xsl:stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dtFormatter="xalan://com.mypack.eip.gui.mapper.util.DateTimeFormatter"
2) exclude it in the same tag
exclude-result-prefixes="dtFormatter" version="1.0">
above 2 steps in same tag

3) now you can use ur object

<xsl:value-of select="dtFormatter:getDateYYMONDD("date")" />

×
×
  • Create New...