Avatar of ethar turky
ethar turky
Flag for Saudi Arabia asked on

generate xml from xsl using xsl v2

Dear all,
I use this <xsl:template name="ignorewhatever" match="template[state = 1]" > 
to select template with state =1
how to select state =1 and template/template_type[type_id=1 ??
Also need to wrapper the xml output with <ROOT>
thanks
XML

Avatar of undefined
Last Comment
Gertone (Geert Bormans)

8/22/2022 - Mon
Gertone (Geert Bormans)

to wrap the XML output with ROOT

<xsl:template match="/">
<ROOT>
<xsl:apply-templates/>
</ROOT>
</xsl:template>

and the other test
<xsl:template name="ignorewhatever" match="template[state = 1][template_type[type_id=1]]" >
ethar turky

ASKER
<xsl:template match="/">
 
<ROOT>

<xsl:template match="template[not(state = 1)]"/>


</ROOT>
</xsl:template>

give an error
ethar turky

ASKER
I think  this expression has a problem
match="template[state = 1][template_type[type_id=1]]"
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Gertone (Geert Bormans)

The expression does not have a problem.
You made a copying error,
you can't have a template nested inside a template
look at what I posted and what you made from it
ethar turky

ASKER
ok, what about this
<xsl:template match="template[not(state = 1)][ template_type[not(type_id=24)]]"/>
Gertone (Geert Bormans)

seems a valid XPath expression
Of course, I have no idea what the source XML is
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ethar turky

ASKER
	<template id="47253">
		<id>47253</id>
		<state>1</state>
		<price>75</price>
		<exc_price>4500</exc_price>
		<downloads>1</downloads>
		<is_flash>0</is_flash>
		<is_adult>0</is_adult>
		<is_full_site>0</is_full_site>
		<inserted_date>2013-11-05 00:00:00</inserted_date>
		<update_date>2013-11-25 21:33:32</update_date>
		<width>1680px</width>
		<is_real_size>1</is_real_size>
		<template_type>
			<type_id>24</type_id>
			<type_name>Joomla Templates</type_name>
		</template_type>
		<author>
			<author_id>247</author_id>
			<author_nick>Jenny</author_nick>
		</author>
		<live_preview_url>joomla_47253</live_preview_url>
		<package>
			<package_id>248</package_id>
		</package>
		<properties>
			<property>
				<propertyName>Features</propertyName>
				<propertyValues>
					<propertyValue>Admin Panel</propertyValue>
					<propertyValue>Responsive</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>Animation</propertyName>
				<propertyValues>
					<propertyValue>HTML plus JS</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>Functionality</propertyName>
				<propertyValues>
					<propertyValue>blog</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>Layout</propertyName>
				<propertyValues>
					<propertyValue>2 columns</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>livePreviewURL</propertyName>
				<propertyValues>
					<propertyValue>joomla_47253</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>width</propertyName>
				<propertyValues>
					<propertyValue>1680px</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>Language support</propertyName>
				<propertyValues>
					<propertyValue>English</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>joomla-engine</propertyName>
				<propertyValues>
					<propertyValue>2.5.9</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>joomla-compatibility</propertyName>
				<propertyValues>
					<propertyValue>2.5.9</propertyValue>
					<propertyValue>2.5.8</propertyValue>
					<propertyValue>2.5.7</propertyValue>
				</propertyValues>
			</property>
			<property>
				<propertyName>Installation</propertyName>
				<propertyValues>
					<propertyValue>Installation and set up instructions are attached (look for Documentation folder).</propertyValue>
				</propertyValues>
			</property>
		</properties>
		<screenshots_list>
			<screenshot>
				<uri>47200/47253-joom-b-p.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-rs.jpg</uri>
				<filemtime>2013-10-31 05:10:15</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-joom-b.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
				<main_preview>1</main_preview>
			</screenshot>
			<screenshot>
				<uri>47200/47253-banner.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-origin.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-original-1200.jpg</uri>
				<filemtime>2013-10-31 05:10:15</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-modules.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-m.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
				<small_preview>1</small_preview>
			</screenshot>
			<screenshot>
				<uri>47200/47253-origin-1200.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-smart1-responsive.jpg</uri>
				<filemtime>2013-10-31 05:10:15</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-big.jpg</uri>
				<filemtime>2013-11-22 10:11:28</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-tablet-responsive.jpg</uri>
				<filemtime>2013-10-31 05:10:15</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-med.jpg</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-smart2-responsive.jpg</uri>
				<filemtime>2013-10-31 05:10:15</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-joom.html</uri>
				<filemtime>2013-10-31 05:10:14</filemtime>
			</screenshot>
			<screenshot>
				<uri>47200/47253-original.jpg</uri>
				<filemtime>2013-10-31 05:10:15</filemtime>
			</screenshot>
		</screenshots_list>
		<keywords>yoga studio club health body mind spirit stress specials services announcement benefits classes practice hatha kripalu yoga basics pilates ashtanga &amp;amp; anusara pre-natal specialized karma teacher training iyengar kids yoga meditation therapeutic</keywords>
		<styles/>
		<categories>
			<category>
				<category_id>14</category_id>
				<category_name>Sport</category_name>
			</category>
		</categories>
		<sources_available_list>
			<source>
				<source_id>3</source_id>
			</source>
			<source>
				<source_id>12</source_id>
			</source>
		</sources_available_list>
		<sources> .PSD&lt;br&gt;.PHP</sources>
		<software_required_list>
			<software>
				<software_id>8</software_id>
			</software>
			<software>
				<software_id>26</software_id>
			</software>
			<software>
				<software_id>53</software_id>
			</software>
			<software>
				<software_id>238</software_id>
			</software>
		</software_required_list>
		<software_required> Adobe Photoshop CS+; Adobe Dreamweaver 8+ (or any php-editor); For uncompressing a template ZIP package:&lt;br&gt; WinZip 9+ (Windows);&lt;br&gt; Stuffit Expander 10+ (Mac); Joomla! 2.5.9</software_required>
		<pages>
			<page>
				<name>Main Page</name>
				<screenshots>
					<scr>
						<description>Real Size Screenshot</description>
						<uri>47200/47253-rs.jpg</uri>
						<scr_type_id>78</scr_type_id>
						<width>970</width>
						<height>280</height>
						<href/>
					</scr>
					<scr>
						<description/>
						<uri>47200/47253-joom.html</uri>
						<scr_type_id>179</scr_type_id>
						<width>430</width>
						<height>60</height>
						<href/>
					</scr>
					<scr>
						<description>Joomla Main Page preview</description>
						<uri>47200/47253-joom-b.jpg</uri>
						<scr_type_id>178</scr_type_id>
						<width>430</width>
						<height>376</height>
						<href/>
					</scr>
					<scr>
						<description>Joomla Modules Positions</description>
						<uri>47200/47253-joom-b-p.jpg</uri>
						<scr_type_id>182</scr_type_id>
						<width>430</width>
						<height>376</height>
						<href/>
					</scr>
					<scr>
						<description>Tablet Layout </description>
						<uri>47200/47253-tablet-responsive.jpg</uri>
						<scr_type_id>298</scr_type_id>
						<width>430</width>
						<height>574</height>
						<href/>
					</scr>
					<scr>
						<description>Smartphone Layout 1 </description>
						<uri>47200/47253-smart1-responsive.jpg</uri>
						<scr_type_id>299</scr_type_id>
						<width>430</width>
						<height>900</height>
						<href/>
					</scr>
					<scr>
						<description>Smartphone Layout 2</description>
						<uri>47200/47253-smart2-responsive.jpg</uri>
						<scr_type_id>300</scr_type_id>
						<width>320</width>
						<height>900</height>
						<href/>
					</scr>
				</screenshots>
			</page>
		</pages>
		<basic_colors>
			<red>0</red>
			<orange>1</orange>
			<yellow>32</yellow>
			<green>38</green>
			<cyan>126</cyan>
			<blue>21</blue>
			<pink>56</pink>
			<purple>50</purple>
			<brown>2</brown>
			<grey>190</grey>
			<white>231</white>
			<black>19</black>
		</basic_colors>
		<colors_mixes>
			<cyan>126</cyan>
			<cyan_grey>23940</cyan_grey>
			<cyan_grey_pink>1340640</cyan_grey_pink>
			<cyan_grey_purple>1197000</cyan_grey_purple>
			<cyan_grey_white>5530140</cyan_grey_white>
			<cyan_pink>7056</cyan_pink>
			<cyan_pink_purple>352800</cyan_pink_purple>
			<cyan_pink_white>1629936</cyan_pink_white>
			<cyan_purple>6300</cyan_purple>
			<cyan_purple_white>1455300</cyan_purple_white>
			<cyan_white>29106</cyan_white>
			<grey>190</grey>
			<grey_pink>10640</grey_pink>
			<grey_pink_purple>532000</grey_pink_purple>
			<grey_pink_white>2457840</grey_pink_white>
			<grey_purple>9500</grey_purple>
			<grey_purple_white>2194500</grey_purple_white>
			<grey_white>43890</grey_white>
			<pink>56</pink>
			<pink_purple>2800</pink_purple>
			<pink_purple_white>646800</pink_purple_white>
			<pink_white>12936</pink_white>
			<purple>50</purple>
			<purple_white>11550</purple_white>
			<white>231</white>
		</colors_mixes>
	</template>

Open in new window

ASKER CERTIFIED SOLUTION
Gertone (Geert Bormans)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.