The XML i'm using has multiple ROWS, i need to check value of one ROW and extract other ROW values. But for some reason i'm not able to succeed. Can you pls help.
PFB XSLT code
<?xml version="1.0" encoding="UTF-8"?>
<!--
XSL_ShapeMap.xsl
Abstract - The following XSL file is a stylesheet that
creates an HTML table of Shape Summary information
based on a Visio VDX file. This stylesheet supports the
output on the Solution Design Hardware Table report.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://ift.tt/tCZ8VR"
xmlns:my="http://ift.tt/1uHbDwD"
xmlns:vis="http://ift.tt/1qlnOZi"
xmlns:r="http://ift.tt/1bA4cfb">
<xsl:template match="/">
<table border="1" cellpadding="0" cellspacing="0"
style="BORDER-COLLAPSE: collapse"
bordercolor="#111111" width="100%">
<!-- Display the column names. -->
<tr>
<td width="10%" bgcolor="#c6d9f1">
<p style="text-align:center; font:bold 10pt Arial;
MARGIN-TOP: 3px; MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 3px">
Environment
</p>
</td>
<td width="10%" bgcolor="#c6d9f1">
<p style="text-align:center; font:bold 10pt Arial;
MARGIN-TOP: 3px; MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 3px">
Location
</p>
</td>
</tr>
<!-- Apply the template for displaying
the rows. -->
<xsl:apply-templates select="my:PageContents" />
</table>
</xsl:template>
<xsl:template match="my:Shapes">
<xsl:for-each select="//my:Shape/my:Section/my:Row[@N='SBB_Class']">
<!-- Apply a template for each shape that isn't
a Dynamic Connector. The shape's information
will display as a row of the table. -->
<tr>
<td bgcolor="#ffffff">
<p style="font:normal 10pt Tahoma;
MARGIN-TOP: 3px; MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 3px">
<xsl:if test="//my:Shape/my:Section/my:Row[@N='Environment']">
<xsl:value-of select= "@N" />
</xsl:if>
</p>
</td>
<td width="66%" bgcolor="#ebdbed">
<p id="idLastModifiedDate" style=
"font:normal 10pt Tahoma;
MARGIN-TOP: 3px; MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 3px">
<xsl:choose>
<xsl:when test="/my:PageContents/my:Shapes/my:Shape">
<xsl:value-of select= "@Name" />
</xsl:when>
<xsl:otherwise>
(No value found)
</xsl:otherwise>
</xsl:choose>
</p>
</td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
In the XML there are multiple ROWs under Shape, I need read all the shapes and if the shape has "SBB_Class" then i need to extract value of that row and fields of other rows as well(values presend in Cell of each Rows). PFB XML
<?xml version="1.0" encoding="utf-8" ?>
<PageContents xmlns="http://ift.tt/1uHbDwD" xmlns:r="http://ift.tt/1bA4cfb" xml:space="preserve">
<Shapes>
<Shape ID="3" NameU="Existing Service" Name="Existing Service" Type="Group" LineStyle="6" FillStyle="6" TextStyle="6" UniqueID="{1E5E586C-0702-486D-AB90-8F678CE9E949}">
<Cell N="PinX" V="3.385826771653544" />
<Cell N="PinY" V="4.035433070866141" />
<Cell N="Width" V="0.866141732283463" />
<Cell N="Height" V="0.5905511811023612" />
<Cell N="LocPinX" V="0.4330708661417315" F="Width*0.5" />
<Cell N="LocPinY" V="0.2952755905511806" F="Height*0.5" />
<Cell N="Angle" V="0" />
<Cell N="FlipX" V="0" />
<Cell N="FlipY" V="0" />
<Cell N="ResizeMode" V="0" />
<Cell N="EventDblClick" V="0" F="RUNMACRO("TAF___Visio_Template.NewMacros.ShapeDataMacro")" />
<Cell N="EventDrop" V="0" F="RUNMACRO("TaxonomySelectorMacro(12)")" />
<Cell N="ObjType" V="8" />
<Section N="User">
<Row N="SBB_Name">
<Cell N="Value" V="Existing Service" U="STR" F="Prop.SBB_Name" />
<Cell N="Prompt" V="RRRR" />
</Row>
<Row N="Short_Name">
<Cell N="Value" V="0" />
<Cell N="Prompt" V="NNNN" />
</Row>
<Row N="Proposed_SBB_Name">
<Cell N="Value" V="0" />
<Cell N="Prompt" V="WNNN" />
</Row>
<Row N="SBB_ID">
<Cell N="Value" V="ES001" U="STR" F="Prop.SBB_ID" />
<Cell N="Prompt" V="NNNN" />
</Row>
<Row N="SBB_Class">
<Cell N="Value" V="Existing Service" U="STR" F="Prop.SBB_Class" />
<Cell N="Prompt" V="NNNN" />
</Row>
<Row N="SBB_Type">
<Cell N="Value" V="Existing Service" U="STR" F="Prop.SBB_Type" />
<Cell N="Prompt" V="RRRR" />
</Row>
<Row N="Environment">
<Cell N="Value" V="Development" U="STR" F="Prop.Environment" />
<Cell N="Prompt" V="WWRR" />
</Row>
<Row N="Service_Model_Name">
<Cell N="Value" V="0" />
<Cell N="Prompt" V="WWWR" />
</Row>
No comments:
Post a Comment