soycharliente Posted December 15, 2009 Share Posted December 15, 2009 Hello. Trying to make an application that reads an XML document and an XSL document for use in PHP. Right now I can't get the document styled correctly. My xsl:value-of isn't working right now. I have only just begun learning about this kind of thing and don't understand why the value isn't being pulled through. Don't know exactly what question to ask (other than the obvious "what's wrong? why is it not working?"), so if you need more info, fire away and maybe we can hash this out. Thanks. XSL: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:template match="/Report/Group"> <xsl:for-each select="Group"> <xsl:for-each select="Details"> <xsl:for-each select="Section"> <xsl:value-of select="Field[Name='ADDRESS']/Value" /> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> VERY SMALL amount of sample XML: <?xml version="1.0" encoding="UTF-8" ?> <Report> <Group Level="1"> <Group Level="2"> <Details Level="3"> <Section SectionNumber="0"> <Field Name="FIRSTNAME"><FormattedValue>F1</FormattedValue><Value>F1</Value></Field> <Field Name="MIDDLENAME"><FormattedValue>M1</FormattedValue><Value>M1</Value></Field> <Field Name="LASTNAME"><FormattedValue>L1</FormattedValue><Value>L1</Value></Field> <Field Name="ADDRESSLINE"><FormattedValue>123 Street</FormattedValue><Value>123 Street</Value></Field> <Field Name="ADDRESSCITY"><FormattedValue>Atlanta</FormattedValue><Value>Atlanta</Value></Field> <Field Name="ADDRESSSTATE"><FormattedValue>GA</FormattedValue><Value>GA</Value></Field> <Field Name="ADDRESSZIP"><FormattedValue>30313</FormattedValue><Value>30313</Value></Field> <Field Name="EMAIL"><FormattedValue>foo@example.tld</FormattedValue><Value>foo@example.tld</Value></Field> <Field Name="PHONE"><FormattedValue>(555)555- 5555</FormattedValue><Value>(555)555- 5555</Value></Field> </Section> </Details> <Details Level="3"> <Section SectionNumber="0"> <Field Name="FIRSTNAME"><FormattedValue>F2</FormattedValue><Value>F2</Value></Field> <Field Name="MIDDLENAME"><FormattedValue>M2</FormattedValue><Value>M2</Value></Field> <Field Name="LASTNAME"><FormattedValue>L2</FormattedValue><Value>L2</Value></Field> <Field Name="ADDRESSLINE"><FormattedValue>123 Street</FormattedValue><Value>123 Street</Value></Field> <Field Name="ADDRESSCITY"><FormattedValue>Atlanta</FormattedValue><Value>Atlanta</Value></Field> <Field Name="ADDRESSSTATE"><FormattedValue>GA</FormattedValue><Value>GA</Value></Field> <Field Name="ADDRESSZIP"><FormattedValue>30313</FormattedValue><Value>30313</Value></Field> <Field Name="EMAIL"><FormattedValue>foo@example.tld</FormattedValue><Value>foo@example.tld</Value></Field> <Field Name="PHONE"><FormattedValue>(555)555- 5555</FormattedValue><Value>(555)555- 5555</Value></Field> </Section> </Details> </Group> <Group Level="2"> <Details Level="3"> <Section SectionNumber="0"> <Field Name="FIRSTNAME"><FormattedValue>F3</FormattedValue><Value>F3</Value></Field> <Field Name="MIDDLENAME"><FormattedValue>M3</FormattedValue><Value>M3</Value></Field> <Field Name="LASTNAME"><FormattedValue>L3</FormattedValue><Value>L3</Value></Field> <Field Name="ADDRESSLINE"><FormattedValue>123 Street</FormattedValue><Value>123 Street</Value></Field> <Field Name="ADDRESSCITY"><FormattedValue>Atlanta</FormattedValue><Value>Atlanta</Value></Field> <Field Name="ADDRESSSTATE"><FormattedValue>GA</FormattedValue><Value>GA</Value></Field> <Field Name="ADDRESSZIP"><FormattedValue>30313</FormattedValue><Value>30313</Value></Field> <Field Name="EMAIL"><FormattedValue>foo@example.tld</FormattedValue><Value>foo@example.tld</Value></Field> <Field Name="PHONE"><FormattedValue>(555)555- 5555</FormattedValue><Value>(555)555- 5555</Value></Field> </Section> </Details> <Details Level="3"> <Section SectionNumber="0"> <Field Name="FIRSTNAME"><FormattedValue>F4</FormattedValue><Value>F4</Value></Field> <Field Name="MIDDLENAME"><FormattedValue>M4</FormattedValue><Value>M4</Value></Field> <Field Name="LASTNAME"><FormattedValue>L4</FormattedValue><Value>L4</Value></Field> <Field Name="ADDRESSLINE"><FormattedValue>123 Street</FormattedValue><Value>123 Street</Value></Field> <Field Name="ADDRESSCITY"><FormattedValue>Atlanta</FormattedValue><Value>Atlanta</Value></Field> <Field Name="ADDRESSSTATE"><FormattedValue>GA</FormattedValue><Value>GA</Value></Field> <Field Name="ADDRESSZIP"><FormattedValue>30313</FormattedValue><Value>30313</Value></Field> <Field Name="EMAIL"><FormattedValue>foo@example.tld</FormattedValue><Value>foo@example.tld</Value></Field> <Field Name="PHONE"><FormattedValue>(555)555- 5555</FormattedValue><Value>(555)555- 5555</Value></Field> </Section> </Details> </Group> <Group Level="2"> <Details Level="3"> <Section SectionNumber="0"> <Field Name="FIRSTNAME"><FormattedValue>F5</FormattedValue><Value>F5</Value></Field> <Field Name="MIDDLENAME"><FormattedValue>M5</FormattedValue><Value>M5</Value></Field> <Field Name="LASTNAME"><FormattedValue>L5</FormattedValue><Value>L5</Value></Field> <Field Name="ADDRESSLINE"><FormattedValue>123 Street</FormattedValue><Value>123 Street</Value></Field> <Field Name="ADDRESSCITY"><FormattedValue>Atlanta</FormattedValue><Value>Atlanta</Value></Field> <Field Name="ADDRESSSTATE"><FormattedValue>GA</FormattedValue><Value>GA</Value></Field> <Field Name="ADDRESSZIP"><FormattedValue>30313</FormattedValue><Value>30313</Value></Field> <Field Name="EMAIL"><FormattedValue>foo@example.tld</FormattedValue><Value>foo@example.tld</Value></Field> <Field Name="PHONE"><FormattedValue>(555)555- 5555</FormattedValue><Value>(555)555- 5555</Value></Field> </Section> </Details> <Details Level="3"> <Section SectionNumber="0"> <Field Name="FIRSTNAME"><FormattedValue>F6</FormattedValue><Value>F6</Value></Field> <Field Name="MIDDLENAME"><FormattedValue>M6</FormattedValue><Value>M6</Value></Field> <Field Name="LASTNAME"><FormattedValue>L6</FormattedValue><Value>L6</Value></Field> <Field Name="ADDRESSLINE"><FormattedValue>123 Street</FormattedValue><Value>123 Street</Value></Field> <Field Name="ADDRESSCITY"><FormattedValue>Atlanta</FormattedValue><Value>Atlanta</Value></Field> <Field Name="ADDRESSSTATE"><FormattedValue>GA</FormattedValue><Value>GA</Value></Field> <Field Name="ADDRESSZIP"><FormattedValue>30313</FormattedValue><Value>30313</Value></Field> <Field Name="EMAIL"><FormattedValue>foo@example.tld</FormattedValue><Value>foo@example.tld</Value></Field> <Field Name="PHONE"><FormattedValue>(555)555- 5555</FormattedValue><Value>(555)555- 5555</Value></Field> </Section> </Details> </Group> </Group> </Report> Quote Link to comment https://forums.phpfreaks.com/topic/185277-xsl-transformations-using-for-each-with-tag-attributes/ Share on other sites More sharing options...
soycharliente Posted December 15, 2009 Author Share Posted December 15, 2009 I realize the name is wrong. When replaced with a valid name, still nothing outputs. Quote Link to comment https://forums.phpfreaks.com/topic/185277-xsl-transformations-using-for-each-with-tag-attributes/#findComment-978081 Share on other sites More sharing options...
soycharliente Posted December 17, 2009 Author Share Posted December 17, 2009 I have taken a different avenue. Won't be needing help on this topic anymore. Quote Link to comment https://forums.phpfreaks.com/topic/185277-xsl-transformations-using-for-each-with-tag-attributes/#findComment-979326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.