Last post Feb 14, 2013 06:08 AM by Decker Dong - MSFT
Member
2 Points
11 Posts
Feb 13, 2013 09:41 AM|wozy69|LINK
Hi All,
Is this the correct way to write this xslt ? First is the XML snippet I want to convert, second is the xslt I'm writing and finally the result:
<ysl:TableNodeStyle TableRenderingOrder="RowsFirst"> <ysl:TableNodeStyle.Table> <y:Table Insets="30,0,0,0" RelativeLocation="0,0"> <y:Table.Rows> <y:Row MinimumSize="10" Size="185.389513343799" Insets="30,0,0,0" Style="{y:GraphMLReference 2}"> <y:Row.Labels> <y:Label LabelModelParameter="{x:Static ysl:StretchStripeLabelModel.West}" Style="{y:GraphMLReference 1}" PreferredSize="72,15"> <y:Label.Text>Development</y:Label.Text> </y:Label> </y:Row.Labels> </y:Row>
=========================================================================================
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:ysl="http://www.yworks.com/xml/yfiles-for-silverlight/1.0/xaml" > <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <xsl:element name="graphml"> <xsl:element name="graph"> <xsl:element name="TableNodeStyle"> <xsl:attribute name="TableRenderingOrder"><xsl:value-of select="TableRenderingOrder"/></xsl:attribute> <xsl:element name="TableNodeStyle.Table"> <xsl:element name="Table"> <xsl:attribute name="Table"><xsl:value-of select="Table"/></xsl:attribute> <xsl:element name="Table.Rows"> <xsl:element name="Row"> <xsl:attribute name="Row"><xsl:value-of select="Row"/></xsl:attribute> <xsl:element name="Label"> <xsl:attribute name="Label"><xsl:value-of select="Label"/></xsl:attribute> <!--<y:Row.Labels> <y:Label LabelModelParameter="{x:Static ysl:StretchStripeLabelModel.West}" Style="{y:GraphMLReference 1}" PreferredSize="72,15"> <y:Label.Text>Development</y:Label.Text>--> </xsl:element> </xsl:element> </xsl:element> </xsl:element> </xsl:element> </xsl:element> </xsl:element> </xsl:element> </xsl:template> </xsl:stylesheet>
=======================================================================================
<?xml version="1.0" encoding="utf-8"?> <graphml> <graph> <TableNodeStyle TableRenderingOrder=""> <TableNodeStyle.Table> <Table Table=""> <Table.Rows> <Row Row=""> <Label Label="" /> </Row> </Table.Rows> </Table> </TableNodeStyle.Table> </TableNodeStyle> </graph> </graphml>
=============================
THis doesnt seem to be right... Any help most appreicated.
All-Star
94130 Points
18109 Posts
Feb 14, 2013 06:08 AM|Decker Dong - MSFT|LINK
Hi wozy69,
If you only want to convert from a given xml snippet of codes, you can:
1) Open Vs and copy the whole xml contents into an xml file (xml should be the file's extension).
2) Then double click the file to open that.
3) Then click the Xml Tool Bar (Generate Schema for XSLT).
Also you can have a demo like this:
http://www.codeproject.com/Articles/12998/XSL-Transform-Code-Generator-for-Visual-Studio-NET
If this cannot solve your problem, please tell us:
What expected result do you want?
Member
2 Points
11 Posts
XSLT to convert an XML to XML not giving results expected... Please help!
Feb 13, 2013 09:41 AM|wozy69|LINK
Hi All,
Is this the correct way to write this xslt ? First is the XML snippet I want to convert, second is the xslt I'm writing and finally the result:
=========================================================================================
=======================================================================================
=============================
THis doesnt seem to be right... Any help most appreicated.
All-Star
94130 Points
18109 Posts
Re: XSLT to convert an XML to XML not giving results expected... Please help!
Feb 14, 2013 06:08 AM|Decker Dong - MSFT|LINK
Hi wozy69,
If you only want to convert from a given xml snippet of codes, you can:
1) Open Vs and copy the whole xml contents into an xml file (xml should be the file's extension).
2) Then double click the file to open that.
3) Then click the Xml Tool Bar (Generate Schema for XSLT).
Also you can have a demo like this:
http://www.codeproject.com/Articles/12998/XSL-Transform-Code-Generator-for-Visual-Studio-NET
If this cannot solve your problem, please tell us:
What expected result do you want?