[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Ways to Identify & Process Same name XML elements dif
Some elements such as: <string> <array> <dict> appear repeatedly at multiple levels in this SB XML format, But they mean different things based on where they are located; mean different things at different locations, depths or parent/ ascendent What are the different ways I can tackle processing these elements and fix & improve my <xsl templates>? Details about the original Springboard .plist XML structure is outlined & attached below: http://iky1e.tumblr.com/post/11704062690/springboard-icon-layouts-iconstatepl ist Temporarily, to simplify Template Matches, I replaced few repeating "same name" elements with "distinct" names - Root: <plist> - remains as it is - Outer <dict> replaced by <all> - Represents all: Pages, Folders, Apps -- 1st level <array> replaced by <pages> --- 2nd level <array> replaced by <page> ----- Inner: <dict> remains same - Represents Folders inside Pages ------- <string> also means different things at different locations, depths or parent/ ascendent XSL - Leverages the modified elements to create viewable display Some Flaws/ Gaps: - Need guidance to rewrite more "Intelligent" templates without needing the above "substitutions" https://www.dropbox.com/sh/1m6qmhrrfxze5kj/AACdkK9HRQS7PXahZeX_uMC_a?dl=0 Dropbox Folder contains: Current XSLT, Original SB XML and the Modified SB XML (that works with Current XSLT). Need to figure out how to process Original SB XML with the Common Element names at varying locations. Current XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="/"> <html> <head> <title>X</title> <!-- <link rel="stylesheet" href="style.css" type="text/css"></link> --> <link rel="stylesheet" href="css/style.css" type="text/css"/> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="all"> <!-- Enter ALL <br/> --> <!-- Button Bar only --> <ul> <!-- <xsl:comment>Test Comment KC</xsl:comment><span>TEST Call KC</span> --> <xsl:call-template name="KeyCategory"/> <!-- <xsl:comment>Test Comment FSDN</xsl:comment><span>TEST Call FSDN</span> --> <!-- <xsl:call-template name="FolderStringDisplayName"></xsl:call-template> --> <xsl:apply-templates select="array"/> <!-- Apply to & Process Items under Button Bar --> </ul> <!-- Button Bar only --> <xsl:apply-templates select="pages"/> <!-- Apply to & Process Items under Pages --> </xsl:template> <xsl:template match="pages"> <xsl:comment>Enter PAGES</xsl:comment> <xsl:apply-templates/> <xsl:comment>Exit PAGES</xsl:comment> </xsl:template> <xsl:template match="page"> <xsl:comment>Enter PAGE</xsl:comment> <ul> <h2>Pg: <xsl:value-of select="./attribute::num"/> </h2> <li> <input type="checkbox"> <xsl:attribute name="checked">checked</xsl:attribute> </input> <i/> <h2>Folder 1</h2> <p>Apps 1 </p> </li> <xsl:apply-templates/> </ul> <xsl:comment>Exit PAGE</xsl:comment> </xsl:template> <xsl:template match="dict"> <!-- Enter Dict <br/> --> <!-- <xsl:call-template name="KeyCategory"></xsl:call-template> <xsl:call-template name="FolderStringDisplayName"></xsl:call-template> --> <li> <input type="checkbox"> <xsl:attribute name="checked">checked</xsl:attribute> </input> <i/> <!--<h2>Folder 1</h2> --> <h2> <xsl:value-of select="./string[1]"/> </h2> <p>Apps: </p> <xsl:apply-templates select="array"/> </li> </xsl:template> <xsl:template match="array"> <!-- Enter Array <br/> --> <xsl:apply-templates/> </xsl:template> <xsl:template match="string"> <!-- AppName --> <!--<p>App: <span style="color:#0000ff"><xsl:value-of select="."/></span></p> --> <p> <span> <xsl:value-of select="."/> </span> </p> </xsl:template> <!-- <xsl:template match="string"> <xsl:apply-templates select="//*[not(ancestor::dict)]"/> </xsl:template> --> <xsl:template name="KeyCategory"> <h2> <b>KC: </b> <span style="color:#ff0000"> <xsl:value-of select="./key[1]"/> </span> </h2> </xsl:template> <xsl:template name="FolderStringDisplayName"> <b>FolderName: </b> <span style="color:#ff0000"> <b> <xsl:value-of select="./string[1]"/> </b> </span> </xsl:template> </xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|